Alexandr
Alexandr

Reputation: 1901

Debug and release configurations for global variable in Windows Phone

I have two different URL for debug and release mode: "http://release.myurl.com/" and "http://debug.myurl.com/".

What better way to declare global property in Windows Phone 8? Which is dependent on the mode used different constants and to be able to use them in C# and XAML.

Upvotes: 0

Views: 679

Answers (1)

Tamay
Tamay

Reputation: 206

If you take a look at a app.xaml.cs file of a fresh windows phone project, you'll notice this line: if (Debugger.IsAttached) {

That's how to detect if the debugger is attached or not. Now ofcourse thats not yet exactly what you want. You might use compiler directives like this to have different code for debug mode:

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

Upvotes: 1

Related Questions