I have a strange issue
#if (!DEBUG)
checkLicense();
#endif
This is working correctly in both Release
and Debug
configurations. But when I try to publish using release configuration this condition does not execute. It looks like publish is using the debug dll.
What have I missed?
There is a setting to control whether the DEBUG constant is defined for each project based on the different deployment modes. See this answer to verify that the constant is being defined for 'release mode' by making sure the Define DEBUG constant
checkbox is checked.
If the box isn't checked, then your debug code is being removed by the preprocessor before compiling your site and no code will execute, even if you include the ELSE as the other answer suggested.
If that doesn't work, then another possibility is be that the machine you're running your release code on could have its machine.config
with the deployment element:
<deployment retail="true" />
This element overrides the web.config
setting for your application and sets the debug flag to false for all .NET applications on the machine.
So if possible, check that. Although I think the first option I gave you is much more likely.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With