# Setting Compiler Constants with Build VS.Net Solution in FB6

**URL:** https://www.finalbuilder.com/forums/t/setting-compiler-constants-with-build-vs-net-solution-in-fb6/1303
**Category:** Discussion
**Created:** [August 27, 2009, 3:50am UTC](https://www.finalbuilder.com/forums/t/setting-compiler-constants-with-build-vs-net-solution-in-fb6/1303 "2009-08-27T03:50:48Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![caltit](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@caltit](https://www.finalbuilder.com/forums/u/caltit)
#### Post date: [August 27, 2009, 3:50am UTC](https://www.finalbuilder.com/forums/t/setting-compiler-constants-with-build-vs-net-solution-in-fb6/1303/1 "2009-08-27T03:50:48Z")

</div>

Hello,

I am trying to override some compiler constants with the the "Build VS.Net Solution" task

I checked "overide compiler settings" in the build pane and entered the following in "compiler constants":&nbsp;

\_RELEASE=%DefineRelease%;\_MAJOR\_VERSION=%DefineMajorVersion%;\_MINOR\_VERSION=%DefineMinorVersion

(I have reason why I don t want to use the provided action properties for versionning... they just are a bit lenghty to explain)

Does not seem to work (the compiler cannot resolve the macros)?

Can someone help me figure out why?

Thanks!

---

<div class="post-metadata">

### Author: ![paulsamways](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/p/e8c25b/32.png) [@paulsamways](https://www.finalbuilder.com/forums/u/paulsamways)
#### Post date: [August 28, 2009, 2:08am UTC](https://www.finalbuilder.com/forums/t/setting-compiler-constants-with-build-vs-net-solution-in-fb6/1303/2 "2009-08-28T02:08:16Z")

</div>

Hi Charlie,   
  
 The action seems to be working as expected here, could you send the command line arguments that FinalBuilder is generating so we can see what’s been sent to Visaul Studio?   
  
 i.e.   
  
 Running C:\Windows\[Microsoft.NET](http://Microsoft.NET)\Framework\v2.0.50727\MSBuild.exe with parameters : /t:Build /logger:“I:\FB6Branch\FinalBuilder\FinalBuilder.MSBuild.Tasks.dll” /noconlog /p:Configuration=“Debug”;Platform=“Any CPU”;DefineConstants="\_RELEASE=True";Optimize=False;AllowUnsafeBlocks=False /v:normal “C:\Users\paul\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1.sln”   
  
 Regards,   
 Paul.

---

<div class="post-metadata">

### Author: ![caltit](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@caltit](https://www.finalbuilder.com/forums/u/caltit)
#### Post date: [September 1, 2009, 9:07am UTC](https://www.finalbuilder.com/forums/t/setting-compiler-constants-with-build-vs-net-solution-in-fb6/1303/3 "2009-09-01T09:07:31Z")

</div>

Thanks Paul,   
  
 Here is what I have (with diagnostic log level)   
  
 Running C:\WINDOWS\[Microsoft.NET](http://Microsoft.NET)\Framework\v2.0.50727\MSBuild.exe with parameters : /t:Rebuild /logger:“C:\Program Files\FinalBuilder 6\FinalBuilder.MSBuild.Tasks.dll” /noconlog /p:Configuration=“Release”;Platform=“Win32”;DefineConstants="\_RELEASE=3;\_MAJOR\_VERSION=3;\_MINOR\_VERSION=3";Optimize=False;AllowUnsafeBlocks=False;WarningLevel=4;TreatWarningsAsErrors=False;NoWarn=“4996” /v:diagnostic “E:\BuildServer\Source\CPP\Utilities\UtilityLibrary.sln”   
  
 Charlie

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [September 3, 2009, 2:34am UTC](https://www.finalbuilder.com/forums/t/setting-compiler-constants-with-build-vs-net-solution-in-fb6/1303/4 "2009-09-03T02:34:08Z")

</div>

What you are trying to do is not valid. With DefineConstants you are either defining a constant or you are not. This topic on stack overflow has a good discussion on it :   
 [http://stackoverflow.com/questions/166474/msbuild-set-a-specific-preprocessor-define-in-the-command-line](http://stackoverflow.com/questions/166474/msbuild-set-a-specific-preprocessor-define-in-the-command-line)
