Archive for the 'Visual Studio' Category

Shortcut to create properties in Visual Studio

Type “prop” and then press tab twice:

public int MyProperty { get; set; }

“propfull”, then tab twice, will generate the field and the full property.

private int myVar;

public int MyProperty
{
get { return myVar;}
set { myVar = value;}
}

Disable jScript Intellisense

From the Visual Studio menu select:

Tools -> Options -> Text Editor -> JScript

Then uncheck Auto List Members and Parameter Information.

Also, uncheck options under Miscellaneous – Show Syntax errors

How to move ToolStripMenuItems

Pretty basic stuff, but it can drive you crazy if you don’t remember how.

Move menu items

Breakpoint in Application_Error

If you are trapping errors in the Application_Error event, you need to change the VS 2008 Debug settings to let the error pass through to the app event, rather than breaking at point in the code where the error occurred.

Under Options / Debugging / General – uncheck Enable Just My Code

ASP Net – Parser Error – Could not load type ‘xxx.global’

I started getting this error out of the blue and it was brutal. All dlls were compiled through VS 2008 and everything ran fine locally, but, as soon as I loaded the dll to the hosted server, the error appeared. I looked through hundreds of posts, but nothing would resolve the issue. I couldn’t even create a one page web site.

I ended up doing a fresh install on VS 2008 on a separate machine and that dll worked. I then did a XP repair on the initial machine and created a new user profile. Using the new profile, I could compile a dll that would work. When I logged into the old profile the error came back.

In this instance, something got screwed up in the initial profile that must have been causing a version conflict or some other issue. Not really sure how it happened, but I am glad it is over.

javascript debugging in VS 2008

If you want to step through your javascript code in VS 2008, be sure to add the js as a separate file, rather than inline. Unhandled js errors will still break to the error point, but breakpoints do not appear to function for inline js.

Unrecognized tag prefix or device filter

While working with VS 2008, I was getting this warning all through my asp .net code in addition to having no intellisense for any asp controls.

If I added the tag to my child pages, intellisense would come back. I saw a lot of other posts relating to VS 2005 which said to keep the master page open, but that didn’t work.

I had to do the following to get intellisense back:

1. Remove the masterPagefile setting in web.config

2 Delete everything from C:\Documents and Settings\[Username]\ApplicationData\Microsoft\VisualStudio\9.0\ReflectedSchemas

3. Add MasterPageFile=”[master page file name]” to the top of each child page.

Show “Start Page” in VS 2008

View / Other Windows / Start Page