Posted by Sem Dendoncker on August 25th, 2009
Hi,
Visual studio has a default project folder.
This project folder points to “C:\Users\{USERNAME}\Documents\Visual Studio 2008\Projects”.
But I don’t like using this path as my default project folder.
So here’s the “trick” to change your default projectfolder for visual studio 2008 (this also works for 2005).
When opening VS2008 you go to “Tools” –> “Options” (see fig 1.1).
When the option screen is opened you go to “Projects and Solutions” –> “General” and there you can change your “Projects location” to whatever you want (see fig 1.2).
fig 1.1 (click to enlarge)

fig 1.2 (click to enlarge)

This way you can fast navigate to your own default project location.
Cheers,
Sem
Posted by Sem Dendoncker on May 5th, 2009
Hi,
I think every C# developer has allready used Visual Studio 2003 or 2005.
There used to be a code snippet who “prop” which gave the following result:
private int myProperty;
public int MyProperty
{
get { return myProperty; }
set { myProperty = value; }
}
The code snippet still exists but has the following result:
public int MyProperty { get; set; }
This has the same function but in many applications you want to be able to be able to use those private variables and keep het public properties seperated.
Therefore I’ve written a custom code snippet.
The only thing you need to do is to download the codesnippet here.
You can save this anywhere you like.
Then you open Visual Studio 2008 –> Tools –> Code Snippets Manager.. (Ctrl+K, Ctrl+B).
You select by language Visual C# and click Import –> choose your saved file and press ok.
Now you can use “prope” in your code (type “prope” and press tab twice) and you will see the result, I’ve added a region arround the property to clean up the code if you collapse it (you can easely remove this code).
If there are still some questions pls don’t hesitate to contact me.
Cheers,
Sem
Posted by Sem Dendoncker on April 16th, 2009
Hi,
If you work long enough on a product, you’ll see that the “using” section on top of your classes are starting to grow.
To clean these up you can rightclick –> organise usings –> remove, sort or remove and sort. This last one will remove the unused usings and sort the remaining ones.
If you do not feel like rightclicking all the time you can customize a shortcut key to do this.
To do this go to Tools –> Options –> Keyboard.
You will see a screen containing all the Actions possible within Visual studio.
In the “Show commands containing:” type “using” (without the double quotes). You’ll see all the commands with the word “using” in it.
One of them will be “EditorContextMenus.CodeWindow.OrganizeUsings.RemoveAndSort”, select it and then you can set the new shortcut key. I’ve used Ctrl+K, Ctrl+J (this wasn’t used yet).
Your window should look something like this:

If you have done all of this press Assign and finally press Ok.
Now you can just use the shortkey Ctrl+K, Ctrl+J to cleanup your using section.
You can use this method to assign any action within Visual Studio to a shortcut key.
Cheers,
Sem
Recent Comments