How do I debug JavaScript in Visual Studio 2005?

10,839

Solution 1

I prefer using Firebug for projects I can't use Visual Studio 2008 on.

Solution 2

To debug in Visual Studio 2005, make sure that "disable script debugging" is unchecked. Then load your webpage in Internet Explorer. From the debug menu inside of Visual Studio 2005, select "Attach to process" and pick the instance of Internet Explorer that has your web page loaded.

Alternatively, the Firebug team has been working on a "lite" version that you can include either as a script in your page or by launching it via a bookmarklet from your browser. It doesn't provide the full debugger that Firebug does, but it gives you a console and a command line from which you can inspect variables and log things to the console.

Solution 3

TechRepublic has a good walk through - see Visual Studio 2008 simplifies JavaScript debugging.

Solution 4

Visual Studio 2008 ASP.NET projects has debugging enabled by default. You can set breakpoints within your .js file while the website/web app project is run in the ASP.NET debug server.

Solution 5

Just make sure you have 'Disable Script Debugging' unchecked, and just hit F5 to start debugging in VS2005 or 2008.

I would also note that if you have your JavaScript inside the .aspx page you will have to find it via the script explore. However if you have it in a separate .js file you can just put a break point on it like you would any .cs file.

Share:
10,839

Related videos on Youtube

Bryan Denny
Author by

Bryan Denny

I am a senior web developer who specializes in .NET, C#, SQL, MVC, Web Forms, Web API and WCF. I design and maintain large web applications from the UI front-end to the code and database back-end. I also have experience developing and publishing Java Android applications. For more information, check out my resume and portfolio website: http://www.bryandenny.com

Updated on June 26, 2020

Comments

  • Bryan Denny
    Bryan Denny almost 4 years

    I just saw this mentioned in Stack Overflow question Best WYSIWYG CSS editor and didn't know it could be done. I'm a Visual Studio newbie, so how do you do it?

    Is there a separate debugger for JavaScript? I know how to work the one for code-behind pages... I usually use Firebug to deal with debugging JavaScript code.

    I'm using Visual Studio 2005.