CurtisMitchell

IThinkTherefore, IBlog

Changing the default Virtual Directory/[TARGETVDIR] name in a Visual Studio Setup Project

one comment

While working on a Visual Studio Setup Project for an ASP.NET MVC application, I ran into an interesting dilemma. The installer automatically uses the Title of your setup project as the default virtual directory value. From a user experience standpoint, it can serve as a visual indicator that this "virtual directory" is specifically for the application that you (the user) are installing.

However, it isn’t ideal. See, usually the title of an installer is human readable e.g. "My Application". However, I don’t think user would want their virtual directory to contain spaces since spaces typically get escaped to a hex value, making your site’s address http://someserver/My%20Application. Visual Studio Setup Projects do not offer a straight-forward way of editing this default value, except to edit your title to read "MyApplication".

There are a handful of solutions that have been conceived by various people that include passing command line arguments or using custom dialog windows that set the TARGETVDIR parameter explicitly – to name a couple.

For different reasons, none of the proposed solutions satisfied my dilemma.

So, here is what I did:

I opened the deployment project in notepad++ (a very handy text editor), found the line that says, "VirtualDirectory" = "My Application" and changed it to "VirtualDirectory" = "MyApplication". After saving the file, reloading it in Visual Studio, and building my installers, my dilemma was solved. I hope this is helpful to you as well.

Written by curtis

February 19th, 2010 at 12:14 pm

Posted in Miscellaneous

One Response to 'Changing the default Virtual Directory/[TARGETVDIR] name in a Visual Studio Setup Project'

Subscribe to comments with RSS

  1. Hello. Good post, with that information I managed to find the actual location in visual studio to set it.
    Right click on the install project, chose view->File System.
    Then select the Web Application Folder’s and there you will find the Virtual Directory folder.

    Same result, just more “point and click user friendly”

    Kresten Markussen

    1 Aug 10 at 2:08 am

Leave a Reply