I'm trying to get my project to evaluate a compiler switch (/define:ORACLE) using a #if.
The syntax I'm using is:
#if ORACLE
using DAL=mydll.Oracle;
#else
using DAL=mydll.SqlServer;
#endif
The problem is that this always drops into the SQL server leg, anf ideas on how to get it to use the Oracle leg??
Using Visual Studio 2005 & C#
Thanks Ash...
Loading
AlanPosted Jun 18, 2007, 6:10 PM
When you added ORACLE as a conditional compilation symbol in the build properties, did you set 'all configurations' and not just 'debug' or 'release' specifically?
Ashley JacksonPosted Jun 18, 2007, 5:23 PM
AlanPosted Jun 18, 2007, 2:55 PM
Well, it certainly looks as though it should work properly :-/
In fact I tried something similar myself (from the VS 2005 command line) with the /define:ORACLE switch, namely this console app:
using System;
#if ORACLE
using DWORD = System.Int32;
#else
using DWORD = System.Int64;
#endif
class Test
{
static void Main()
{
DWORD dw = (long)3;
}
}
As expected, I was informed by the compiler that you can't implicitly convert a long to an int, so that seems to be working OK :)
Are you sure, you haven't got an #undef ORACLE in your source code somewhere cancelling out the effect of the command line switch?