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

221
Vistas
How to stop VS from removing "unused" namespaces if they are actually used in preprocessor directives?

I'm using Visual Studios Code Cleanup on Save to automatically clean my code when i save. It also removes unused namespaces. But now i noticed that it even removes namespaces when they are actually in use in preprocessor directives. What can i do to avoid it?

enter image description here

Code is here:

    private void RegisterTracking()
    {
#if DEBUG
        IResourceFilePostProcessor processor = null;
#else
        IResourceFilePostProcessor processor = new ResourceFilePostProcessor();
#endif
        For<ITrackingResourceFileService>().Add(new TrackingResourceFileService(processor));
    }    

Actually i think this is a visual studio bug because it should not be seen as unused.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Putting the using in a preprocessor directive seems to work.

#if !DEBUG
using xyz.EpiServer.Core.Tracking;
#endif
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