I have a config file that contains all the configurations of my program. In that file, I define a directive as follow:
---------- MyConfig.cs ------------
#define TEST_LOCALHOST
public class MyConfig
{
....
}
Now, from another file (MyWebService.cs), I define a variable MyServerName based on the directive TEST_LOCALHOST is defined or not as follow:
---------- MyWebService.cs ------------
using MyData;
public class MyWebService
{
#if (TEST_LOCALHOST)
private static string MyServerName = "http://localhost:8888";
#else
private static string MyServerName = "http://MYSERVER";
#endif
}
The namespace structure in my program is:
| ----- WebService | ---------------- MyWebService.cs | | ----- Data | ---------------- MyConfig.cs
However, the TEST_LOCALHOST is always not defined in MyWebService.cs. I mean, my variable MyServerName is always pointing to "http://MYSERVER", but not to "http://localhost".
Am I missing something?