What is the best way to run and report Visual Studio 2012 code analysis in TeamCity?
Since FxCop or Code Analysis integrates directly into MsBuild, it's probably as simple as adding /p:RunCodeAnalysis=Always or /p:RunCodeAnalysis=True to the MsBuild commandline when building the project. Since this will generate standard compiler warnings, TeamCity should pick them up automatically.
Visual Studio 2010+ Code Analysis is (based on) FxCop 10.0. You can simply add a 'FxCop' build runner type build step.
When the 'Report XSLT file' setting is configured the build runner will output a HTML report. FxCop 10.0 includes a default XSLT file under '%system.FxCopRoot%/Xml/FxCopReport.xsl' to generate a default HTML report.
Related
How to debug a project file in MSBuild 12.0 / VS2013? has an answer, but apparently that method is not supported in Visual Studio 2015/MSBuild 14. Does anyone know a way to perform MSBuild debugging in Visual Studio 2015/MSBuild 14? Bonus points for scoop about Visual Studio 2017.
The MSBuild debugger was never officially supported and was cut from MSBuild in favor of cross-platform support in the VS 2015/MSBuild 14 timeframe.
There are many ways to debug the behavior of a build. The combination of a Verbosity=Diagnostic build log and the preprocessed project (msbuild /pp:preprocessed.xml path\to\the.csproj creates a file containing all of the build logic for a given project) is extremely powerful. You may also be interested in the UI that the MSBuildStructuredLog provides, which helps pare down the massive output produced by a diagnostic log.
It really works well in old VS version:
But if I use the VS2015, I got the same issue as yours, it could recognize the /debug command line.
I report this issue to the product team here:
https://connect.microsoft.com/VisualStudio/feedbackdetail/view/3120913/how-to-debug-a-project-file-in-msbuild-14-0-vs2015
You could check the latest update from it, of course, please also vote and add your comment there:)
I have a Visual Studio solution consisting of several projects. I set a build process for it in TeamCity, and I have added a an NUnit runner build step, with these settings:
nunit runner 2.6.3
run tests from: %teamcity.build.workingDir%\Sources\**\bin\*.Web.UnitTests.dll
.net coverage tool: JetBrains dotCover
Filters: --empty--
In the Code Coverage tab of the build, under Coverage Breakdown, I can only see:
MyProject.Domain
MyProject.Web.UnitTests
MyProject.Web, the object of the tests, and a few other assemblies in the solution are not displayed there, and are ignored by the dotCover code coverage calculations. Why? How can I tell it which assemblies to use?
I've unsuccessfully tried various +: / -: combinations in the Filters field. But with Filters empty, I am expecting MyProject.Web to be included, since MyProject.Domain is - why isn't it included?
Are you building in Release or Debug mode? I had the same problem with Release mode and had to enable PDB output which is what dotCover requires to determine the code coverage. PDB is not enabled by default for Release builds.
To enable it go to Project Settings -> Build -> Advanced (button at the bottom) -> Debug Info -> Choose "pdb-only" or "full".
Additionally, dotCover provides this statement when no code coverage can be determined. It may be helpful to check all of the reasons listed:
No executable code was detected.
The issue could be caused by one of the following:
Include / exclude patterns are incorrect
Assemblies are compiled without debugging information
.pdb files are not available
Visual Studio code coverage is enabled for MSTest
.testrunconfig is used for MSTest and Visual Studio code coverage is not disabled (CodeCoverage section with enable="true" is present)
I'm afraid without log files and your snapshot it will be difficult to provide the right answer. Please submit a request and attach the files: http://dotnettools-support.jetbrains.com/anonymous_requests/new
If logs are not enabled yet, add the corresponding parameter to your build configuration to activate them: https://confluence.jetbrains.com/display/TCD9/Reporting+Issues#ReportingIssues-dotCoverIssues
I have a Visual Studio 2010 .NET 4 solution with C# projects and a C++/CLI project.
I use Visual Studio's built in unit tests and code coverage.
Other than the fact that Visual Studio 2010 coverage tool for C++/CLI projects seems to be much weaker than Visual Studio 2008 coverage tool, I get weird results.
For example, I get uncovered code in this file:
c:\program files (x86)\microsoft
visual studio 10.0\vc\include\xstring
And some other files in that directory.
I want to exclude this code from coverage results.
Is there a way to put some exclude attributes on that code?
If not, is there a different automatic way to exclude that code from coverage? If not, is there a way to use EXCLUDE option to exclude it? Can it be done automatically within Visual Studio without running the coverage tool from command prompt?
Any other solutions?
Well, the MSDN documentation you linked to says:
EXCLUDE option is supported with code coverage.
To exclude all functions in a namespace use the wildcard character:
MyNamespace::*
Have you tried /EXCLUDE:std::* ? It sounds as if that would be the way to go.
Here is a problem with specific StyleCop configuration.
I've got a total of two Settings.StyleCop files in my Visual Studio .Net solution folders.
The first is placed at the folder root with chosen rules for the team.
As I want to disable some rules for a specific project, I've put another Settings.StyleCop file in the corresponding project folder.
The results are:
when launching analysis from Visual Studio IDE (Run StyleCop), the project specific file is considered and no violation occurs.
when launching analysis from StyleCopCmd (command tool) the project specific file seems to be ignored and some violations occur.
when launching analysis from MSBuild target the project specific file seems also to be ignored and some violations occur.
Did I miss something with StyleCop configuration to have different results from ?
I'm using: Windows XP StyleCop 4.3 MSBuild 3.5 SP1 MSBuild Extension Pack 3.5.0.0 StyleCopCmd 0.2.1.0
The problem seems to be the same with StyleCop 4.3.1.3 and MSBuild Extension Pack 3.5.3.0
Regards,
Olivier.
I have some projects which I wrote in C++ and compile with Visual Studio 2005. I'm using SVN for source control. Could you recommend an auto-build system to compile my code?
Cruisecontrol or Cruisecontrol.net are both good for this kind of task. You can use them either alone or in partnership with a build (not autobuild) tool e.g. ant or nant.
(They are both free).
Don't be put off by their java or .net basis, either will happily allow you to build visual studio c++ from svn.
see
http://cruisecontrol.sourceforge.net/
http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET
FinalBuilder is second to none, check it: http://www.finalbuilder.com/