Option to disable stylecop MSBuild integration
Currently, FxCop Analysis can be switched off for Performance reasons. For the same reason it would be great to have a Setting where the StyleCop build Integration (http://www.nuget.org/packages/StyleCop.MSBuild/) can be switched off as well.
An additional benefit would be that there is no need anymore to occasionally reset the NCrunch test pipeline because of build failures (it cannot copy the StyleCop NuGet package which is at that time in use by another NCrunch process).
Why should a package prevent you from building?
Is a horrible idea and should be removed by whatever instructions put it in the csproj file.
Ralf Koban commented
Thanks, I go for the Option to use the StyleCopEnabled property.
But I had to change $(NCrunch) to '$(NCrunch)' to get it working.
<StyleCopEnabled Condition="'$(NCrunch)' == '1'">false</StyleCopEnabled>
There should be many ways to introduce this override - we just need to find a place that works well for your solution :)
It looks like StyleCop has a property that can be used to switch it off. Adding the following property to each of your projects could also do this:
<StyleCopEnabled Condition="$(NCrunch) == '1'">false</StyleCopEnabled>
If you have any target files shared between projects (recommended for large solutions), you could also include this property in one of them to avoid needing to touch every project.
In theory, this could even be done with the core MS .target files inside the .NET framework, although I don't necessarily recommend it.
My preference is to avoid having a huge array of specially targeted configuration options for NCrunch. There's already far more than I'd prefer. I'd rather only look at introducing a configuration option to control this if there is high demand for it.
Ralf Koban commented
I'm not sure whether this is feasible especially for large solutions.
On one side there is already a condition on the Import.
<Import Project="..\Solution\packages\StyleCop.MSBuild.188.8.131.52\build\StyleCop.MSBuild.Targets" Condition="Exists('..\Solution\packages\StyleCop.MSBuild.184.108.40.206\build\StyleCop.MSBuild.Targets')" />
On the other side, the Import is automatically added by the NuGet package, so each time we update to a new version, we need to manually adjust the condition. We have solutions with more than 160 projects, so it takes quite a long time for that adjustment (and can easily go wrong / miss something).
Are there other options already available?
It should be possible to disable build steps such as this using an NCrunch build override.
For example, if the build step (i.e. StyleCop) is happening as a result of a target file import, you can simply set a condition on this import tag to avoid importing it when running the code under the context of NCrunch.
<Import Project="$(ProgramFiles)\MSBuild\Microsoft\StyleCop\v4.3\Microsoft.StyleCop.targets" />
<Import Condition="$(NCrunch) != '1'" Project="$(ProgramFiles)\MSBuild\Microsoft\StyleCop\v4.3\Microsoft.StyleCop.targets" />
This would disable the StyleCop build logic for NCrunch builds, while leaving it intact for your normal build.