Currently, I am dealing with a C# asp.net framework Visual Studio solution where the .aspx/.ascx files contain script tags. To streamline our processes, we reference minified files on the pages using a mechanism outside of Visual Studio.
The challenge arises during debugging, as I have to manually remove the .min from the script tag to render the non-minified file. Unfortunately, developers often forget to add back the .min in the .aspx/.ascx files, leading to non-minified files being rendered in both non-production and production environments.
I am seeking a solution that automatically removes the .min.js from the script file when the web project runs in DEBUG configuration. This way, developers do not need to make manual changes and risk forgetting to revert them later.
My goal is to have the script tag appear as <script src=abc.js></script> in the DEBUG configuration, possibly achieved through code behind to insert the entire script tag. Unfortunately, using RegisterStartUpScript may not be suitable as there are MVC files in the project as well.
I attempted to insert a script tag via C# code-behind but was unsuccessful in my efforts.