I have a WPF windows application that makes a call to a DLL for registration. I need this code to be called only when the application is run outside of visual studio. In other words, when clicking run from within the visual studio, I dont want this code executed but want it executed if EXE is called outside of visual studio.
Is there a开发者_StackOverflow way where I can do that withouht having to keep commenting and uncommenting this code?
you could use the preprocessor:
#if DEBUG
code to run during debug mode only
#else
normal code
#endif
or the Conditional attribute
[Conditional("DEBUG")]
private void SomeMethod()
{
stuff
}
精彩评论