Professional Programmer Notes

or just call this my soapbox

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

with 2 comments

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.

Advertisements

Written by curtismitchell

February 19, 2010 at 12:14 pm

Posted in Uncategorized

2 Responses

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

    August 1, 2010 at 2:08 am

  2. To add to Kresten,
    Right click on the install project, chose view->File System.
    Then highlight the Web Application Folder and then in the properties window you will find the Virtual Directory setting.

    Patrick Nolan

    March 8, 2011 at 5:46 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: