Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

241
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda