Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

236
Visualizações
How to fail .NET 4.5 build with Microsoft.CodeAnalysis.NetAnalyzers?

I am attempting to use Microsoft.CodeAnalysis.NetAnalyzers in a legacy .NET 4.5 app that cannot be upgraded for reasons.

According to the documentation you can install the Microsoft.CodeAnalysis.NetAnalyzers NuGet package and use the Analysers in 'older' .net versions. How old, I am not sure.

If you don't want to move to the .NET 5+ SDK, have a non-SDK-style .NET Framework project, or prefer a NuGet package-based model, the analyzers are also available in the Microsoft.CodeAnalysis.NetAnalyzers NuGet package.

The Errors do show in the Visual Studio Error List under "Build + IntelliSense" but do not show under the regular "Build" so subsequently the build does not fail even if there are errors configured in the .editorconfig

I imagine that the Visual Studio IntelliSense is using the .NET 5 SDK to show the errors and then the actual build is using .NET 4.5 so is unaware of the analysis rules? But then what is the NuGet package supposed to be doing?

Is this just not supported in such an old .NET Framework version? That quote from the documentation suggests that some older frameworks should be able to use it.

I have a blank, file new project .NET 4.5 Console app with Microsoft.CodeAnalysis.NetAnalyzers installed and a simple .editorconfig with a sample rule

dotnet_diagnostic.IDE0010.severity = error

If so, what are alternatives? StyleCop "Classic"?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

As I know old code analysis uses ruleset file, not .editorconfig. I found also documentation about it. I use code analysis in .NET Framework projects like this:

  • right-click on the project and go to Properties,
  • go to Code Analysis tab,
  • in active rules there is by default Microsoft Managed Recommended Rules - click on Configure button,
  • search for IDE0010 and select error and save ruleset,
  • ensure that now in Code Analysis tab you have your file selected in active rules option.
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda