How to conditionally add Javascript code if you are in Visual Studio debug mode
You can conditionally add Javascript code if you
are in Visual Studio depending on whether you are running
debug mode or release mode using the example below:
Below assumes you are editing a .cshtml file that
has a script block. This example may not work if the file
is a .js
@if (HttpContext.Current.IsDebuggingEnabled)
{
//js code goes here.
alert('I am running in debug mode');
}else{
//js code goes here.
alert('I am running in release mode');
}
See also