I suggest you ...

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).

3 votes
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)

We’ll send you updates on this idea

Ralf Koban shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

5 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...
  • Anonymous commented  ·   ·  Flag as inappropriate

    Why should a package prevent you from building?
    Exists('..\..\packages\StyleCop
    Is a horrible idea and should be removed by whatever instructions put it in the csproj file.

  • Ralf Koban commented  ·   ·  Flag as inappropriate

    Hi Remco,

    Thanks, I go for the Option to use the StyleCopEnabled property.
    But I had to change $(NCrunch) to '$(NCrunch)' to get it working.

    <PropertyGroup>
    <StyleCopEnabled Condition="'$(NCrunch)' == '1'">false</StyleCopEnabled>
    </PropertyGroup>

  • AdminRemco Mulder (NCrunch Developer, NCrunch Website) commented  ·   ·  Flag as inappropriate

    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:

    <PropertyGroup>
    <StyleCopEnabled Condition="$(NCrunch) == '1'">false</StyleCopEnabled>
    </PropertyGroup>

    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  ·   ·  Flag as inappropriate

    Hi Remco,

    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.4.7.49.0\build\StyleCop.MSBuild.Targets" Condition="Exists('..\Solution\packages\StyleCop.MSBuild.4.7.49.0\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?

  • AdminRemco Mulder (NCrunch Developer, NCrunch Website) commented  ·   ·  Flag as inappropriate

    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.

    i.e.

    <Import Project="$(ProgramFiles)\MSBuild\Microsoft\StyleCop\v4.3\Microsoft.StyleCop.targets" />

    Would become:

    <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.

Feedback and Knowledge Base