views:

42

answers:

1

I’m trying to use a Visual Studio Setup Project to deploy a C# Application.

In a VS Setup project, is it possible to dynamically change the application folder before a project is installed, or even to add any code behind the set-up project at all?

What I am trying to achieve is an msi that runs, calculates the installation directory based on some external factors and then installs to that directory. I then want it to run the application immidiately. The objective for this is no user intervention throughout.

A: 

Edit: Seeing your amended question I think that you'll still want to look at a custom action but that you want to look at this msdn page instead. It's about changing the target location in various ways.

As 0xA3 says, the user can choose the target folder during the install.

Re your own code, you probably want to look at Custom Actions. You can write your own code in a DLL that can then be called from the Custom Actions.

This walkthrough is a good sample.

ho1
I don't understand from this how the custom action concept can work to change the installation directory. When you try to add a custom action, it asks you where to get the output from. In this case, I tell it that I was to get it from the Application Folder on the target machine - but how can it do this if I want to change it?
pm_2
@pm_2: Yes, I should hve mentioned, you can do this in Visual Studio I think, rather you have to use a more advanced tool. For example Orca. This question contains information about how to use Orca to do this: http://stackoverflow.com/questions/1498057/lost-in-the-visual-studio-maze
ho1