# Trouble using custom constants

**URL:** <https://www.finalbuilder.com/forums/t/trouble-using-custom-constants/1346>\
**Category:** Discussion\
**Created:** [October 18, 2009, 8:52am UTC](https://www.finalbuilder.com/forums/t/trouble-using-custom-constants/1346 "2009-10-18T08:52:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmunro](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/e36b37/32.png) [@kmunro](https://www.finalbuilder.com/forums/u/kmunro)\
**Post date:** [October 18, 2009, 8:52am UTC](https://www.finalbuilder.com/forums/t/trouble-using-custom-constants/1346/1 "2009-10-18T08:52:17Z")

</div>

Hi,

I'm evaluating Finalbuilder and have got everything working fine except for one small problem.&nbsp; I need to set a custom compiler directive for a Visual Studio Project.&nbsp; In the VS&nbsp;IDE, it's set as CLIENT=True.&nbsp; If I&nbsp;set the same thing in the Compiler Constants field of the Build&nbsp;VS.NET Soltion action, I&nbsp;get the following error:

ERROR BC30037 in vbc(0,0) : Project-level conditional compilation constant 'VBC\_VER = 9.0,TARGET = "library",CONFIG="Release",DEBUG=-1,TRACE=-1,\_MyType="Windows",PLATFORM="x86",CLIENT=True; ^^&nbsp; ^^ TRACE' is not valid: Character is not valid.  
&nbsp;

If I&nbsp;take the Compiler Constant it all works fine.&nbsp; Please tell me what I'm doing wrong!

&nbsp;

Best regards,  
Kenny Munro

---

<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:** [October 19, 2009, 12:10pm UTC](https://www.finalbuilder.com/forums/t/trouble-using-custom-constants/1346/2 "2009-10-19T12:10:02Z")

</div>

Hi Kenny   
  
 TRACE is a conditional define… so you just need to have it without a value. If it’s there then it’s value is True, if it’s not it’s value is false.

---

<div class="post-metadata">

**Author:** ![kmunro](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/e36b37/32.png) [@kmunro](https://www.finalbuilder.com/forums/u/kmunro)\
**Post date:** [October 19, 2009, 6:37am UTC](https://www.finalbuilder.com/forums/t/trouble-using-custom-constants/1346/3 "2009-10-19T06:37:35Z")

</div>

Hi Vincent,

Thanks for the reply, it half answers my question!

There is still an issue with the TRACE&nbsp;directive though.&nbsp; When I uncheck the box for TRACE everything works fine and it builds correctly with the compiler custom.&nbsp; It's the combination of the compiler custom & the trace check box that kills it.&nbsp; Incidentally, I&nbsp;even&nbsp; tried leaving TRACE&nbsp;unchecked and adding it manually (i.e. a compiler custom of TRACE;CLIENT=True)&nbsp;but that breaks it too.

Cheers,

Kenny

---

<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:** [October 20, 2009, 12:11pm UTC](https://www.finalbuilder.com/forums/t/trouble-using-custom-constants/1346/4 "2009-10-20T12:11:28Z")

</div>

Ok… this is a STUPID difference the microsoft created between C# and VB. We are just calling MSBuild to build the solution, however the VB compiler expects the defines in a different format from C#. And if you have a solution of mixed VB/C# then you cannot set these defines on the command line.   
  
 The work around is to untick TRACE and DEBUG, and add :   
  
 TRACE=True;DEBUG=True   
  
 Unfortunately C# doesn’t like TRACE=True and will issue a warning and ignore the value.   
  
 HTH

---

<div class="post-metadata">

**Author:** ![kmunro](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/e36b37/32.png) [@kmunro](https://www.finalbuilder.com/forums/u/kmunro)\
**Post date:** [October 20, 2009, 7:55am UTC](https://www.finalbuilder.com/forums/t/trouble-using-custom-constants/1346/5 "2009-10-20T07:55:51Z")

</div>

Hi Vincent,   
  
 Unfortunately that ain’t working either! Still throws exactly the same error - the TRACE=True seems to be getting turned into TRACE=-1 by the time it gets to MSBUILD. Might have to go and figure out another way of setting the compiler constant!   
  
 Thanks,   
 Kenny

---

<div class="post-metadata">

**Author:** ![kmunro](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/e36b37/32.png) [@kmunro](https://www.finalbuilder.com/forums/u/kmunro)\
**Post date:** [October 20, 2009, 7:57am UTC](https://www.finalbuilder.com/forums/t/trouble-using-custom-constants/1346/6 "2009-10-20T07:57:35Z")

</div>

I should add (in case it’s relevant)   
  
 Machine OS is Windows 2008 Server - Standard Edition   
 Using SDK V6.0A (no visual studio installed)   
 Machine is also running FinalBuilder Server

---

<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:** [October 20, 2009, 10:55am UTC](https://www.finalbuilder.com/forums/t/trouble-using-custom-constants/1346/7 "2009-10-20T10:55:24Z")

</div>

Ok, I think I have it now. On the Action properties tab, Set “Extra MSBuild Properties” to :   
  
 DefineTrace=True   
 DefineDebug=False

---

<div class="post-metadata">

**Author:** ![kmunro](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/e36b37/32.png) [@kmunro](https://www.finalbuilder.com/forums/u/kmunro)\
**Post date:** [October 20, 2009, 11:08am UTC](https://www.finalbuilder.com/forums/t/trouble-using-custom-constants/1346/8 "2009-10-20T11:08:10Z")

</div>

Brilliant! That seems to have nailed it, working fine now.   
  
 Many thanks Vincent!
