-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build does not fail upon .editorconfig rule violations in Microsoft.CodeAnalysis.CSharp.CodeStyle -Version 3.8.0-3.final #47835
Comments
cc: @mavasani |
Version 3.8.0-3.final of the NuGet package requires VS2019 16.8 Preview3 - I verified it works fine that VS version. We have recently moved CodeStyle NuGet package to always build against the latest Roslyn bits, hence the requirement. You have following options:
(2) is our recommended approach, which allows you completely get away from managing/upgrading CodeStyle Nuget package versions and just get the analyzers directly from .NET SDK. |
@mavasani |
Yes, you just need to upgrade to the .NET5 RC2 or later SDK for your repo, your project can have any pre-Net5 framework as your TargetFramework. Basically, NET5 SDK is the shipping vehicle for these style analyzers; analyzers themselves are framework independent. |
Also tagging @gewarren - we should probably add the above point to the CodeStyle analysis doc section as a Note, already couple of folks have asked me if they require moving their projects to Net5 target framework for EnforceCodeStyleInBuild property to work. |
It seems (3) is the only feasible solution for us. We can't upgrade to .NET5 at the time due to other dependencies. I'm surprised that it worked for other version of the CodeStyle (in myget.org) and older version of VS 2019 (16.7.x) but the final release in nuget only works for 16.8 and later. |
Note the suggestion is not to migrate/upgrade your projects to .NET5. It is just switching to the .NET5 SDK, without changing any of the target framework for your projects.
All the published CodeStyle NuGet packages on myget were just daily packages produced from Roslyn repo over the last few months. They were built against older Roslyn bits, hence it worked on older VS builds. Going forward the NuGet package is not our primary recommended route for getting these analyzers, they should only be used for exceptional circumstances (note that newly published NuGet package on nuget.org will only work with latest VS release/pre-release). Analyzers ship with the .NET SDK, and they should be enabled from the SDK for regular consumption. |
Hi @mavasani, While I understand the rationale behind that, it is not very practical in concrete use cases. Note: at our job, all the projects have enabled "warning as error". Case #1:
Case #2:
We are struggling BIG TIME with this change right now because we have all at once:
|
Version Used:
Microsoft.CodeAnalysis.CSharp.CodeStyle -Version 3.8.0-3.final
Steps to Reproduce:
Microsoft.CodeAnalysis.CSharp.CodeStyle -Version 3.8.0-3.final
in the projectExpected Behavior:
Actual Behavior:
Further observation:
Microsoft.CodeAnalysis.CSharp.CodeStyle 3.8.0-1.20330.5
), it works fine (i.e. expected behavior).CS8032 warnings:
The text was updated successfully, but these errors were encountered: