How To: Remove Workspaces from Visual Studio

January 25th, 2010 / No Comments » / by Mike

I usually work using Team Foundation Systems over VPN. And sometimes my VPN access is revoked because I no longer work for a particular client, when this happens my Visual Studio Workspaces is stock there, I can’t reuse the same folder. I’ve been looking into this and found a fairly simple solution from Greg.

  1. Open the Command Line ( Start -> Run -> cmd)
  2. Go to:  C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE (or C:\Program Files\Microsoft Visual Studio 8\Common7\IDE for Visual Studio 2005)
  3. Execute: tf workspaces /remove:workspace

This probably works with Visual Studio 2010, I should update this post whenever I try it!

ASP.Net MVC RSS Feed Action Result

September 22nd, 2009 / No Comments » / by Mike

ASP.NET MVC ships with a few ActionResult but lacks an RSS Feed ActionResult. I required one for a small project at work, so I started looking on the web if there was something interesting before coding my own. Well the googling was successful! I found a nice piece of code by Guy Burstein.

If you need such an ActionResult in your application, I would recommend you to read his article first!

ASP.NET MVC Extension Methods of UrlHelper

September 21st, 2009 / 10 Comments » / by Mike

I think this is kind of obvious, but I guess it might not be for everyone because I’ve seen some code where people do not use this! URL Helpers are really easy to setup, it takes only a few minutes and will probably save you a lot of massive Search & Replace in the future!

public static string Image(this UrlHelper helper, string fileName)
{
    return helper.Content("~/Content/Images/" + fileName));
}

public static string Stylesheet(this UrlHelper helper, string fileName)
{
    return helper.Content("~/Content/Stylesheets/" + fileName);
}

public static string Script(this UrlHelper helper, string fileName)
{
    return helper.Content("~/Content/Scripts/" + fileName);
}

So instead of doing this:

<link href="../../../Content/StyleSheets/Main.css" rel="stylesheet" type="text/css" />

You can do this:

<link href="<%= Url.Stylesheet("Main.css")%>" rel="stylesheet" type="text/css" />

These are just 3 common examples, you should do the same thing for things you use a lot.