Monday, March 26, 2012

How to determine current Visual Studio configuration at runtime?

Three steps:
1.      Add a new configuration into solution
2.      In the property of this project, Add a Conditional Compilation Symbol for this configuration
3.      In code, check if this symbol existed by Preprocessor directives.



        public static bool ProVersion
        {
            get
            {
#if PRO_VERSION
                return true;
#else
                return false;
#endif
            }
        }

Reference:
http://stackpopstudios.com/tutorial-using-visual-studio-solution-configuration-to-manage-free-vs-paid/


No comments:

Post a Comment