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

206
Visualizações
Conditional compilation symbols not being defined for non asp.net project

I have a C# Library Project. I have defined a Conditional Compilation Symbol: SHOULDWORK

enter image description here

But the problem is that this symbol is NOT being defined. I have no idea why. enter image description here

This is not an asp.net project. I am using VS 2013. I have used Preprocessor Definitions extensively in c++ so it is nothing new to me. But I just can't figure out what the problem is.

I tried rebuilding, restarting VS but to no avail. I tried using the SHOULDWORK symbol on different source files in that same project but the symbol is not defined.

HELP!!!

Just as sidenote, the DEBUG symbol works as expected. It is defined for Debug builds and not defined for Release builds.

** EDIT

The symbol is correctly stored in the *.csproj file: enter image description here

** SOLVED

The csproj had several PropertyGroup entries where DefineConstants was being defined. I manually added the symbols I needed to define to those PropertyGroups and then it worked. It seems the project file was edited manually in the past, which could have led to this. It will need to be cleaned up but at least for now I can move on.

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

0

If using properties panel doesn't work you can modify manually the project file.

  1. Right-click on the file project from vs
  2. Unload project
  3. Right-click again
  4. Edit project file

Now you can modify the project. Find all the propertygroup you are interested in: if you want to add the conditional compilation symbols far all compilation types, you should add the symbol in every single PropertyGroup related to compilation. This is an example of a propertygroup for compilation:

 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

Inside the group you'll find the tag <DefineConstants> :

PropertyGroup prj

Add here your constant and reload the project. Sure, you can simply modify le prj outside vs, as a simple text file.

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