We used to write our code in visual studio 2013 with stylecop as a seperate plugin. When we wanted to check our code qualtiy we pressed ctrl+shift+y to run stylecop and get a log of infractions (if any)
Recently we switched to visual studio 2017 with resharper and integrated stylecop by JetBrains. While stylecop is still running (blue lines underneath infractions) we can't seem to get a complete log with all our errors (and when building a solution stylecop isn't automatically run).
I tried looking in tools -> Options -> environment -> Keyboard -> Show commands containing "Stylecop" (you used to find lots of settings in VS2013, none in 2017)
Is it still possible to run stylecop like we did in VS2013?
Is it possible to have stylecop run after a build is completed (in a post build event)?
In Vsiual Studio 2017, the easiest way to enable and integrate StyleCop is to enable the StyleCop Roslyn package. That way the Roslyn compiler will automatically run StyleCop live in the editor as well as during build.
Resharper should play nice with this as well and sync its settings to the stylecop settings.
Related
We have a build definition in TFS 2015 that have worked fine with Visual Studio 2015 projects and solutions. We have now decided to upgrade to Visual Studio 2017 and thus we would like to target Visual Studio 2017 in the Visual Studio build task. We have installed Visual Studio 2017 on the build agent. Unfortunately the only options available int the Visual Studio build task are 2012, 2013, 2015 and Latest. We have tried latest but it does not find Visual Studio 2017 on the build agent. It won't work with the msbuild task either.
I have a similiar issue and resolved by installing VS2017 in my build agent server and configuring MSBuild to point to my MSBuild 15.0 folder:
Add MSBuild to your build steps
On the Advanced options, expand and fill the 'Path to MSBuild' like the image below:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin
VS2017 RTM is released recently while TFS2015 was released before. That's why there is no VS2017 option in VS Build Task in TFS2015 Server. If you upgrade your server to the latest TFS2017, you would see "Visual Studio "15" (preview)" option listed in VS Build Task which is the version for VS2017 preview. And in the feature, the option will be updated to VS2017 which is the same as VSTS.
we are facing a similar issue and it is not possible for us to update ourselves as it is maintained on a company level where we cannot take that much influence.
However our team wanted to switch to VS2017 and make use of the C# 7 features. That's why we tried it as well with replacing the build steps from Visual Studio Build to MSBuild. Sadly this did not work as expected (we got some errors during the build).
As our main objective is to use the C# 7 features we looked for a way how to still achieve that at the time with Visual Studio 2015 remaining on the Build Server. We ended up using the nuget package Microsoft.Net.Compilers that, when used in a project, will use that compiler instead of the installed one.
More on this can be found in this Thread.
It seems the updates to the build tools are installed via the command line of the VS2017 installer.
See the docs for details.
Just adding another thing: if you're using custom build template make sure to edit it and modify the ToolPath attribute value to:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin
In Visual Studio 2015, when I attempt to debug a test that uses Typemock (and I use the Visual Studio Test Explorer, not Typemock's SmartRunner), on the first call to a Typemock method I get the following exception:
TypeMock.TypeMockException occurred HResult=-2146233088
Message=
*** Typemock Isolator is currently disabled. Enable using
the following:
Within Visual Studio:
Use Typemock Smart Runner
For other runners, Choose Typemock Menu and click "Integrate with Other Runners"
To run Typemock Isolator as part of an automated process you can:
run tests via TMockRunner.exe command line tool
use 'TypeMockStart' tasks for MSBuild or NAnt
I've followed the instructions and verified that:
Typemock is enabled
I already have "Enable Mocking integration" checked in the settings
Also,
The test runs properly when I choose "Run Selected Tests". I only get the exception when I choose "Debug Selected Tests"
Prior to Visual Studio 2015, I did not get this exception during debugging.
Question: What is causing this problem and how do I fix it?
The IntelliTrace functionality does not work with Typemock. Disabling IntelliTrace in the Visual Studio options (Options->IntelliTrace->General->Enable IntelliTrace) works around the issue.
See:
Typemock: Typemock Isolater is not currently enabled
Typemock: Debug Test on 64 bit machine
Typemock: On Windows 7 x64 with VS 2010
Disclaimer: I work at Typemock
This issue is fixed in Isolator 8.3 and will apply to all following versions.
Isolator 8.3 was released on 2.21.2016 and available for download at www.typemock.com.
Is it possible to use FxCop for .NET 4.5 applications?
I am looking to use FxCop with the Visual Studio 2013 Professional edition.
Visual Studio 2013 Professional comes with Static Code Analysis (which is FxCop, just a fancy name for it).
In this link some information is provided:
As a developer, you can run code analysis on your project automatically or you can run it manually.
To run code analysis each time that you build a project, you select Enable Code Analysis on Build (defines CODE_ANALYSIS constant) on the project's Property Page. For more information, see How to: Enable and Disable Automatic Code Analysis for Managed Code.
To run code analysis manually on a project, on the Analyze menu, click Run Code Analysis on ProjectName. For more information, see How to: Enable and Disable Automatic Code Analysis for Managed Code.
This version runs perfectly on .NET 4.5.
FxCop 1.36 is a standalone version of Code Analysis. Microsoft no longer supports or works on the standalone version and currently only working on the integrated version that is included in Visual Studio.
There is a Uservoice going on which asks Microsoft to update the standalone FxCop version. See this link.
Our final build server does not have Visual Studio 2010 installed. It uses the MSBuild.exe from the .NET 4 SDK. As part of our code delivery process to our customer we need to allow him to build the projects from the command line on a Visual Studio 'agnostic' server and also to run Code Analysis rules on that machine.
On the visual studio side we started out with AllRules.rules and created exceptions going foreward so naturally we'd like the exceptions to carry over to the code analysis on the build server.
Is this possible ?
Thanks in advance.
Using standalone FxCop you can customize your CI process as you wish. Open this link and go to "Setting up continuous FxCop code analysis" chapter.
Link above seems to be dead now. You can try to look here on this SO question
is it somehow possible to run tests with it?
I am always getting message:
(CoreTestConfiguration target) ->
MSBUILD : warning : Visual Studio Team System for Software Testers or Visual Studio Team System for Software Developers is required to run tests as part of a Team Build.
Well it is possible, we have such configuration (VS2010 project and TFS2008 where we store it). Probably when you set up the build on build server you have chosen to run the tests with this build - so please install proper Visual Studio version (Visual Studio Team System for Software Testers or Visual Studio Team System for Software Developers) on the Build Machine. Or setup the build without test option.