Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Using NCrunch, FxCop Analyzers and “warnings as errors”: How to configure warning severity?
ClausAppel3Shape
#1 Posted : Thursday, November 21, 2019 1:27:45 PM(UTC)
Rank: Member

Groups: Registered
Joined: 11/21/2019(UTC)
Posts: 10
Location: Denmark

Thanks: 2 times
Was thanked: 2 time(s) in 1 post(s)
Hi!

I have NCrunch 3.26.0.4. I have <WarningsAsErrors /> set in my CSPROJ files (new CSPROJ format). I want to use FxCop Analyzers as NuGet packages: https://docs.microsoft.c...-analyzers?view=vs-2019

When I first installed the FxCop Analyzers, my code would not build because there were a number of warnings and I have <WarningsAsErrors />. I've downgraded a bunch of warnings to "suggestion" level by adding this to my .editorconfig:

Code:
dotnet_diagnostic.CA2100.severity = suggestion


Now I can build in Visual Studio. But my problem is that NCrunch evidently does not read the .editorconfig file. So NCrunch fails to build the solution because it sees warnings.

How can I configure warning severity levels for NCrunch?

(Also posted on Stack Overflow.)

Thanks in advance!
Remco
#2 Posted : Thursday, November 21, 2019 11:09:07 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for posting.

It's possible that NCrunch just isn't copying the .editorconfig file into the workspace used for building your project. Do you have this file included in your .csproj? If not, does including it make any difference?
2 users thanked Remco for this useful post.
ClausAppel3Shape on 11/22/2019(UTC), UppSol on 11/22/2019(UTC)
ClausAppel3Shape
#3 Posted : Friday, November 22, 2019 7:55:56 AM(UTC)
Rank: Member

Groups: Registered
Joined: 11/21/2019(UTC)
Posts: 10
Location: Denmark

Thanks: 2 times
Was thanked: 2 time(s) in 1 post(s)
Remco;14117 wrote:
It's possible that NCrunch just isn't copying the .editorconfig file into the workspace used for building your project. Do you have this file included in your .csproj? If not, does including it make any difference?

Thanks for the advice! You're right. I had my .editorconfig just as a "solution item". So I did this for each project:

1. Right-click project in Solution Explorer.
2. Select Add -> Existing file.
3. Select the .editorconfig file. Do not click "Add".
4. Click the arrow next to "Add" and select "Add as link".

Repeat for all projects, then restart NCrunch engine. Now NCrunch builds.

Woo! :D
2 users thanked ClausAppel3Shape for this useful post.
UppSol on 11/22/2019(UTC), Remco on 11/22/2019(UTC)
arthgg
#4 Posted : Monday, October 19, 2020 9:26:49 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/20/2011(UTC)
Posts: 2
Location: usa

Thanks: 2 times
Repeat for all projects, then restart NCrunch engine. Now NCrunch builds.

Is there a way to accomplish this more "globally" than adding the link to .editorconfig to every project?

Thank you
Remco
#5 Posted : Monday, October 19, 2020 11:44:23 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
arthgg;15002 wrote:
Repeat for all projects, then restart NCrunch engine. Now NCrunch builds.

Is there a way to accomplish this more "globally" than adding the link to .editorconfig to every project?

Thank you


Unfortunately not. I'll make a note to see if we can do this implicitly in the engine without any configuration, as it seems like a common case.
1 user thanked Remco for this useful post.
arthgg on 10/22/2020(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.047 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download