Disable EnableOptimizations mode in debug mode

Can you tell me how to handle the BundleConfig.cs file below the line when we are in debug mode? Because I need to ignore below line in debug mode. How can i do this? Any help would be much appreciated.

BundleTable.EnableOptimizations = true;

      

+3


source to share


1 answer


The easiest way is to use the #if

Preprocessor directive

#if DEBUG
    BundleTable.EnableOptimizations = false;
#else
    BundleTable.EnableOptimizations = true;
#endif

      

If your application is running in debug mode, Visual Studio detects DEBUG

for you. On the other hand, if your app is running in release, it DEBUG

will be undefined.



To check if a release version is installed , you cannot determineDEBUG

 #if !DEBUG
     BundleTable.EnableOptimizations = true;
 #endif

      

PS: There is no flag for obvious reasons RELEASE

.

+9


source







All Articles