我的WPF应用程序中有编译器指令的简单代码:
#if (DEBUG)
MySettings.Default.Host = "http://localhost:63372/";
#else
MySettings.Default.Host = "http://example.com/";
#endif
所有在Visual Studio中都可以正常工作。当我切换到Release或Debug时,Host
填写正确。但是当我发布时,在反编译器中我看到Host
等于"http://localhost:63372/"
字符串。
哪里有问题?
答案 0 :(得分:0)
你试过了吗?
#if (DEBUG)
MySettings.Default.Host = "http://localhost:63372/";
#endif
#if (!DEBUG)
MySettings.Default.Host = "http://example.com/";
#endif
答案 1 :(得分:0)
我找到了anwser。使用clickOnce发布时,它使用当前选定的模式。因此,我需要切换到发布,然后单击发布。