Sunday, June 17, 2007

Restore IntelliSense for web.config

Sometimes intellisense gets lost for web.config in VS2005.

Seems like it happens after usage of "ASP.NET Configuration" tool. The tool replaces <configuration> tag with <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">, and IntelliSense is not available after that.

To fix the problem - just remove that xmlns="..." from the <configuration> tag. And save the web.config.

 

Labels: , , , , ,

Sunday, June 10, 2007

Fixing Visual Studio 2005 Documentation

Documentation for .NET Framework disappeared after I installed some additional stuff to VS2005 (I guess it was after "Web Client Software Factory - January 2007" installation). On hitting F1 in VS2005 usually I was getting "Information Not Found".

After unsuccessful searches in Google I gave up and decided to try to find the problem myself. That was funny, because I found the solution in a minute.

In case you have the similar problem I would suggest to try the following:

  1. Run Microsoft Visual Studio 2005 Documentation from Start Menu. The Document Exproler should start with the page named The Visual Studio Combined Help Collection.
  2. At the page click on Visual Studio 2005 Combined Help Collection Manager hyperlink. That should go to a page with information on all help collections installed at your machine.
  3. Check all collections you need and hit Update VSCC. Close all instances of Document Explorer and VS2005. On the next start it will update indexes and you should get the help back.

Good luck.

 

del.icio.us tags: , , , , , , , ,

Labels: , , ,

Monday, July 10, 2006

Cleaning up web cache for Visual Studio 2003

Web cache in Visual Studio 2003 (maybe in VS2002 as well) can give you some unpleasant moments. In my case, two branches of the same project behave differently if you compile them manually, and unexpectedly similar if compiled automatically (by NAnt). The reason of the problem was a cached assembly...

Visual Studio 2003 saves cached versions of your web projects in Web Cache directory. And if you are getting strange errors while opening your project, maybe it worth to clean up the cache.

The cache usually located at C:\Documents and Settings\username\VSWebCache. The path can be customized, and stored in registry under
HKCU\Software\Microsoft\VisualStudio\7.1\WebProject\OfflineCacheDir.

Here is a small NAnt snippet to cleanup web cache (VSWebCache) for the current user. It takes path to the cache from the registry, and delete the whole directory for the current user.

NOTE: you'll lose some of you user settings of your web projects, but automatic build will work correctly. But be sure you know what are you doing ;)

<readregistry property="vs_web_cache" key="Software\Microsoft\VisualStudio\7.1\WebProject\OfflineCacheDir" hive="CurrentUser">

<delete dir="${path::combine(vs_web_cache, environment::get-machine-name())}" failonerror="false">

Labels: , ,

Thursday, March 23, 2006

Cool feature in Visual Studio 2005: Tracepoints

That's so obvious, I cannot beleive this feature was not there before!

Idea is really simple (and great!) - perform some action when code line is hit.
How many times you temporary modified a source code just to check how some var is changing by inserting ::OutputDebugString() or something similar.
Now that technique is obsolete. Just insert a tracepoint to that code line, and specify a template for message you want to see in Output window. In addition in the message template you can show Thread ID (for MT debugging), CPU Tick Count (for simple profiling), Call Stack, etc.

To insert tracepoint
Right-click on a line of code, choose Breakpoint \ Insert Tracepoint.
It will show dialog with all instructions.

For more details check MSDN article How to: Specify a Tracepoint/Breakpoint Action

Labels: ,

Saturday, February 25, 2006

JavaScript debugging

After JavaScript debugging with boring alert() and slow Venkman (FireFox extension) I was glad to know that Visual Studio can handle javascripts.

Not only ASP.NET projects can be debugged, but plain HTML + JavaScript sites/pages as well (say - Random Sudoku ;)).

It's pretty easy (not very straightforward though):
1. Be sure Script Debugging in IE is enabled. (Uncheck Disable Script Debugging in Internet Options \ Advanced).
2. Add debugger keyword in your JavaScript. It should be in the function you want to debug.
E.g. if you need to debug Foo() when the keyword in Foo():

Foo = function() {
debugger
var i = 0;
}

If you put debugger outside of Foo() then you will not be able to set breakpoint in there.

3. Start IE, and open your HTML. You'll see Visual Studio Just-In-Time Debugger dialog when debugger keyword is reached.

4. In the dialog choose debugger you wish to use, and enjoy!

Labels: , , , ,