Search code examples
.netvisual-studio-2010deploymentdeployment-project

How to add a shortcut in a VS2010 setup project which does not reevaluate installed files


The situation: I've got a Windows Desktop application that connects to various services (one at a time) to perform various calls. My application works the same way no matter which service it connects to. Which service it should connect to at any time is defined in an application.config file.

In order to switch between services, I've created a couple of windows .bat-files, each of which replaces the existing .config file with the new one (service endpoint) to use.

For all of this, I've created an installer (an MSI, using the "Setup Project" template in Visual Studio 2010). This installer also creates shortcuts to:

  1. the application itself
  2. the first .bat file (which sets the config file with the "default" service endpoint)
  3. the second .bat file. (which replaces the config file with the alternative one)

The problem: Each time I run any of these (the app or the bat files) via the shortcuts, they seem to "reevalueate" the installed files before actually running the target. This is no problem as long as I'm using the default .config file, as that was the way it was installed. If I've run the second .bat file however, and am trying to run the application so it connects to the second service, then starting the application via the shortcut causes the .config-file to be reverted, and I end up connecting to the first service instead.

I'm able to create my own shortcuts manually, both to the .bat files and to the application itself, and they work fine. I'd like this to happen automatically however, without messing up any changes to other files.

Any ideas would be greatly appreciated! Thanks in advance,
-Kjartan


Solution

  • Your deployment project has what is known as an "advertised shortcut". There are several ways to disable those, see the following link:

    http://social.msdn.microsoft.com/Forums/en/vssetup/thread/b57f1d84-9b0c-4c29-b140-0555f92ffed8