C# 编译器指令(调试)在发布时工作错误
我的WPF应用程序中有带编译器指令的简单代码:C# 编译器指令(调试)在发布时工作错误,c#,wpf,C#,Wpf,我的WPF应用程序中有带编译器指令的简单代码: #if (DEBUG) MySettings.Default.Host = "http://localhost:63372/"; #else MySettings.Default.Host = "http://example.com/"; #endif 在VisualStudio中,所有工作都很好。当我切换到Release或Debug时,主机已正确填充。但是当我发布时,在反编译器中我
#if (DEBUG)
MySettings.Default.Host = "http://localhost:63372/";
#else
MySettings.Default.Host = "http://example.com/";
#endif
在VisualStudio中,所有工作都很好。当我切换到Release或Debug时,主机已正确填充。但是当我发布时,在反编译器中我看到Host
等于”http://localhost:63372/“
string
哪里有问题
您是否尝试过:
#if (DEBUG)
MySettings.Default.Host = "http://localhost:63372/";
#endif
#if (!DEBUG)
MySettings.Default.Host = "http://example.com/";
#endif
我已经找到了答案。使用clickOnce发布时,它使用当前选定的模式。所以,我需要切换到release,然后单击Publish。你发布得怎么样?@CodingGorilla:忘了提了。我按逻辑使用ClickOnce,这与OP当前的操作完全相同。