all groups > visual studio .net general > february 2005 >
You're in the

visual studio .net general

group:

Send compiler preprocessing directive when building using devenv.exe


Send compiler preprocessing directive when building using devenv.exe lukev123 NO[at]SPAM gmail.com
2/25/2005 12:48:33 AM
visual studio .net general:
Hi,

I run nightly builds with a set of bat scripts and VS.net 2003. I call
devenv.exe and pass in my solution filename.

I have a number of parts of code that I want "disabled" when I do a
build on the builds server, and the only way I can see doing this is by
having those parts of code in a conditional directive. For example, the
code fragment:

#if(ADD_THIS_CODE)
// some code lines
// that will not compile if
// #ADD_THIS_CODE symbol is not defined
#endif

will only be added if I compile like this
csc mycode.cs /d:ADD_THIS_CODE .... (other options)....

My question is: How do I pass a symbol like ADD_THIS_CODE into vs.net
so that it uses it when building my solution? I.e. can I do something
like:
devenv mysolution.sln /rebuild /d:ADD_THIS_CODE

Thanks in advance,
Luke Venediger
Re: Send compiler preprocessing directive when building using devenv.exe lukev123 NO[at]SPAM gmail.com
2/25/2005 1:25:17 AM
Thanks Carlos,

That might just solve the problem. Just a question about setting the
configuration at a solution level: Does changing which solution
configuration you use update the sln.user file or the sln file? In
other words, do I need to check out the solution file to change the
build configuration that I'm using?

Thanks for your help.
Luke Venediger.
Re: Send compiler preprocessing directive when building using devenv.exe Carlos J. Quintero [.NET MVP]
2/25/2005 10:08:47 AM
Hi Luke,

I don´t know if you can pass conditional compilation constants directly, but
a workaround is to define 2 configurations (Release1 and Release2) in the
Configuration Manager, define the constant in one of them, and pass the
configuration to devenv.exe when building.

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com


<lukev123@gmail.com> escribió en el mensaje
news:1109321313.162415.187750@z14g2000cwz.googlegroups.com...
[quoted text, click to view]

Re: Send compiler preprocessing directive when building using devenv.exe Carlos J. Quintero [.NET MVP]
2/28/2005 11:25:35 AM
I am not sure, but if you change the current solution Configuration from
within the IDE, it will prompt you to checkout what it needs, so you can try
yourself. But on the other hand, when you build from outside the IDE using
devenv.exe /build, you pass the configuration as command line parameter, so
I think that whatever configuration the solution had does not matter. I am
not sure how this relates to your original question, could you clarify?

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com


<lukev123@gmail.com> escribió en el mensaje
news:1109323517.455935.258340@f14g2000cwb.googlegroups.com...
[quoted text, click to view]

AddThis Social Bookmark Button