调试并发布Windows Phone中全局变量的配置



我有两个不同的URL用于调试和发布模式:"http://release.myurl.com/"one_answers"http://debug.myurl.com/".

在WindowsPhone8中声明全局属性的更好方法是什么?这取决于使用不同常量的模式,以及能否在C#和XAML中使用它们。

如果你查看一个新的windows phone项目的app.xaml.cs文件,你会注意到这一行:if (Debugger.IsAttached) {

这就是检测调试器是否附加的方法。当然,这还不是你们想要的。您可能会使用这样的编译器指令来为调试模式提供不同的代码:

#if DEBUG
// code that runs (and even only gets compiled in) when in debug build mode
#else
// not debug mode
#endif

最新更新