4

Is there a way to include a different Javascript file in an ASP.NET page depending whether it's a debug or release build?

For release builds, I want to include the minified (using yuicompressor) Javascript, but I would like to use the more readable file for debug and development.

2 Answers 2

2

You can do one of two things ... either rename the appropriate file to the filename referenced in the html in a postbuild step, or dynamically include the html based on the preprocessor symbol.

Sign up to request clarification or add additional context in comments.

1 Comment

I think I'll go with the renaming in a postbuild step. Thanks for the nudge in the right direction!
1

For development, if you're using Visual Studio 2008 SP1 you can also take advantage of the improved support for JavaScript IntelliSense. Scott Gu has a blog post here:

jQuery Intellisense in VS2008

The basic set up is:

  1. Install Hotfix KB958502
  2. Reference release versions of your .js files as you would normally
  3. Ensure that you have the "development" version of the .js file sitting next to it, called *-vs-doc.js or *.debug.js

This will get you all the intellisense for the files.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.