Search code examples
c#debuggingdllvisual-studio-debugging

Always running #if debug in dll


I have a property in config named to class like the following in my framework project:

public static string PropertyName
{
    get
    {
      #if DEBUG
          return GetValue("TestDevelopment");
      #else
          return GetValue("Test");
      #endif
    }
}

I've compiled my project. And I added this config.dll file to different project. But always returning GetValue("TestDevelopment") from this dll. I 've compiled Release mode but it's not working.

What's the problem to be? I hope, could tell...


Solution

  • If you compiled the dll as debug, and copied the file to a different one, it'll always be whatever it was when you compiled it.

    You'll have to compile it in Release for it to be in release.