0

Is there a way to define a conditional define, i.e. #const, in a asp/vb.net app that it accessible across multiple source files?

I want to use, for example,

#const useOracle=TRUE

but to be able to change it's value in only one place.

Thanks for any advice.

Bob
  • 327
  • 4
  • 13

1 Answers1

1

You can do this in the project properties (right-click the project in the Solution Explorer, select "Properties"), in the "Compile" tab. Click the "Advanced Compiler Options" button, and enter your constants into the "Custom constants" text box.

Fredrik Mörk
  • 155,851
  • 29
  • 291
  • 343
  • Hi, thanks for the reply. I think I was a little unclear - the project is an ASP.net project - I can't see anywhere to enter custom constants on the property pages, but I'm sure I must be missing something. – Bob Dec 07 '10 at 10:07
  • @Bob: If you have created an "ASP.NET Web Application" project it should work as described above, if you have an "ASP.NET Web Site" project , I don't know any way to do it. Also, if you have a "web site" project, make sure this is what you really want: [ASP.NET: Web Site or Web Application?](http://stackoverflow.com/questions/398037/asp-net-web-site-or-web-application) – Fredrik Mörk Dec 07 '10 at 12:18
  • Thanks, interesting link. Unfortunately, I am developing a web *site* and I'd have to check, but I think this may be a mandatory requirement for where the site will be hosted. – Bob Dec 07 '10 at 12:35