TFSBuild: Disabling Code-Analysis for one project - visual-studio-2012

We have a large VS2012 solution (~250 projects) that is 90% C#. 2 of the 3 C++ projects use the 'v110' Platform Toolset. The third has to use the 'v110_xp' toolset for compatibility with a third party library. Our nightly TFS (2012) build is configured with 'Perform Code Analysis' set to Always.
Unfortunately, the v110_xp platform does not support code analysis (MSDN Blog). This results with the following build failure:
Microsoft.Cpp.Win32.v110_xp.targets(28,5): error MSB8026: Static analysis is not supported with the current platform toolset.
Any ideas how we can prevent code analysis from running on this single project without enabling (by default) code analysis for all projects (except the one)?

You should change the build to be "As Configured" and select I your solution which projects to run analytics on and which not.
https://msdn.microsoft.com/en-us/library/dd547175.aspx

Changing the following helped me:
Configuration Properties -> General -> Platform Toolset
Change was from v120_xp to v120

Related

Specify C# version in ReSharper

I'm slowly migrating projects to VS2017 from VS2015. We have distributed team and until all is verified (there are issues with e.g. Reporting Services, SSIS, etc as there is not fully finished tooling - SSDT) I need the projects could work in VS2015 without changes.
C# projects in VS2017 use latest C# version by default in project settings (in my case it is C# 7.1) and ReSharper started to offer refactoring to these new features. However, I need to resist the temptation and wait until all is migrated (while I still need to be able to write and review code). I need to specify the version of C# to be 6.0. I can do it on per project basis but I would like to avoid this as I would have to go through each project, modify it and push it to source control and when the migration is done then I would have to switch it back.
Is there a way in R# to globally set the C# version in options (haven't found such a setting but maybe there's some hidden option?)
(VS2017 - 15.4.5, ReSharper 2017.2.2)
EDIT
For Typescript there is possibility to specify language level - either auto-detection or exact version. So for C# it could be similar - auto-detection from project settings or exact version. It would allow code review for specific language version without modification of the projects.
I'm adding here also the link to R# support page as I asked there too
Add the following string to solution settings file ({Solution name}.sln.DotSettings file in the solution's root folder)
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/#EntryValue">CSharp60</s:String>

advantages of Roslyn vs ReSharper

When I created project in VS2015 Roslyn is added by default, and I am also using Resharper in my project so can anyone help me to understand any advantages of Roslyn vs Re-sharper
Roslyn is CaaS (Compiler as a service) and enables several features in VisualStudio and additional extensions that can be installed. ReSharper doesn't use Roslyn, but has its own model for code analysis that already serves for over a decade.
Here is a comparison matrix:
https://www.jetbrains.com/resharper/documentation/comparisonMatrix_R2017_1_vs2017.html
Roslyn is the C# compiler and the default C# IDE features. You cannot have a C# project without Roslyn. Resharper adds more C# IDE features (some of these overlap with the default).

How can we use VS2012 Static Analysis Rules with FxCop 10 Standalone

We're struggling to get some rules that work fine in the VS2012 code analysis tool, to appear in FxCop 10.
Specifically we're trying to get CA2100 - "Review sql queries for security vulnerabilities"
We've tried adding the DLLs from VS2012 (11) but it doesn't seem to work.
Our goal is to ultimately run the VS2012 ruleset as part of a TeamCity build, so we'll probably end up with the cmd line version, but our build agents do not have vs installed and hence we need to use the standalone version.
Any help much appreciated
dan
The VS 2012 rule assemblies are compiled against a different version of the FxCop core assemblies than FxCop 10 (which is the same as that used for VS 2010), so no. However, if your goal is to run this as part of an automated build, the version of fxcopcmd.exe (plus its dependencies) found in your VS 2012 installation should work fine on your build server. Licensing considerations may, however, apply.

Testing using an upgraded VS2012 solution, but building in VS2010

So I've downloaded VS2012 RTM and upgraded my Coded UI test projects to the VS2012 versions.
The reason I have done this is because I was having issues with VS2010 Coded UI tools due to partial support of IE9.
So I ran the tests from my developer machine both locally and remotely (making use of the new Visual Studio agent tools), and the tests worked successfully. Presumably, the reason my tests now work is that VS2012 upgraded them so that they now work with IE9, right?
So - this is my problem. I want to automate these tests, by launching them from our build machine - but our build machine still runs on VS2010, and for the time-being this is not going to change.
So I checked in my new VS2012 Coded UI test solution into TFS and queued a new build - so the build machine built my solution. And the build was successful. All good there.
So, next I created a new test case in Microsoft Test Manager and associated with the ordered test list in my new solution. Then I launched the tests (using the existing VS2010 test controller) on my remote test environment (which has the existing VS2010 test agent tools).
But the tests failed - the same issues that affected my tests with the VS2010 Coded UI tests (due to lack of full support for IE9)
Why did they fail?
Do I need the new VS 2012 agent tools for my test controller and agents? Must I build my solution in VS2012?
Ideally, I don't want to have to install VS2012 RTM on my build machine - I want to do the minimum possible to get my tests working and automating.
Is there a way around this?
Your coded ui tests reference assemblies that come with VS installation or your agent's installation (the assemblies defininf the WpfControl, Mouse, Keyboard, Playback and other classes).
So if you run it on a build/test machine with older versions of the dll's the same issues are going to stay, the tests will not start using the newer fixed assemblies thatt were shipped with VS2012.
As a temporary workaround you can check what dll's you reference and make sure that the build process puts them in the same directory with your tests assembly. That way the lookup for them will find the in the current directory without using the /path and finding them in the VS installation directory.

Is code coverage available in VS2012 for metro-style apps?

I am using Windows 8 Pro and Visual Studio 2012 Ultimate (both RTM).
I create a Metro-style class library, and then a corresponding unit test library. Both target WinRT (not the .NET framework).
I can run unit tests fine, but when I attempt to "Analyze code coverage for all tests", the output window comes up with the results of the rebuild, and that's it. The Code Coverage Results window is all grayed out.
From reading on the web, some have alluded to the idea that code coverage is not enabled for WinRT assemblies, but I cannot confirm. I have also tried creating a .testsettings file, like was needed in VS2010 and explicitly turn on code coverage, and I got the same results.
Can anyone confirm or deny that code coverage is not available for WinRT-targeted assemblies, in VS2012 RTM?? I'm just trying to figure out if I'm missing some setting - or if it's not possible.
It's not possible at this stage due to the sandboxed nature of WinRT apps.
P.S. It's on the list of things the team is looking to resolve in the near future (no, I don't have a timeframe for it)

Resources