views:

5774

answers:

6

I have a web setup project which by default shows the virtual directory in the textbox installer screen. I wish that the virtual directory name cannot be edited by the user and always defaults to the one I have setup in my msi. How can this be achieved?

+1  A: 

Switch to Wix and use their Web Extensions

Shay Erlichmen
I am looking at the websetup project as I am not interested in open source as org does not allow it.
chugh97
Shay Erlichmen
A: 

Select your setup project, View > Editors > User Interface, select the Installation Address dialogs, and delete them.

EDIT:

As Shay points out, users can override the default install location from the command line. To override this, you should set the TARGETDIR property in your InstallExecuteSequence. Unfortunately, you cannot change this sequence from Visual Studio, you have to use Orca:

  1. Build your Setup project.
  2. Open the MSI file from Orca.
  3. Create a new custom action of Type 51 (set property) with Source "TARGETDIR" (without quotes), Target of your destination folder, and a unique name for Action (the convention is to use a GUID with initial underscore).
  4. Create a new row in the InstallExecuteSequence with your unique name for Action, "NOT Installed" for Condition, and a sequence number before the use of TARGETDIR (750 was the first use in the sample I made, so I used a sequence of 555).
Dour High Arch
deleting from the UI would still allow the user to change the setup dir via command line.
Shay Erlichmen
A: 

Org does not allow open source, or GPL open source.

Solutions: * edit the custom action (right click>view>custom action) to fix the virtual directory and path Change the customactiondata:

/targetdir="[TARGETDIR]\" /connectionstring="[CONNECTIONSTRING]" /targetvdir="[TARGETVDIR]" /targetsite="[TARGETSITE]"

To:

  /targetdir="[TARGETDIR]\" /connectionstring="[CONNECTIONSTRING]" /targetvdir="FIXED_NAME" /targetsite="[TARGETSITE]"

You might just delete the Installation Address from user interface, and setup a component that passes information to the custom install

  • Write a wrapper over msbuild with msbuildtasks
david valentine
+1  A: 

In order to get the Virtual Directory using Context.Parameters

  1. Add a Custom Action to Install node (use this url if you want to know how to add custom actions)
  2. Right Click on the custom action and select properties window.
  3. For CustomActionsData property set /targetvdir="[TARGETVDIR]".
  4. Now in your installer class you can get the virtual dir name by Context.Parameters["targetvdir"]. Hope this helped you :)
Vikram Sudhini
+9  A: 
RonnBlack
That note about TARGETSITE being a metabase value was a lifesaver - thank you!
ladenedge
Yep I've been searching for hours for TARGETSITE! Cheers!
Markive
+2  A: 

Sounds good in theory but near as I can tell, doesn't work, at least not for setting AppPool. I have a custom action to set the apppool (which by the way works fine when the installer is built with VS2005) in my vs2008 web setup project.

DirectoryEntry IISVdir = new DirectoryEntry(String.Format("IIS://{0}{1}/{2}", strServer, strRootSubPath, Vdir));
IISVdir.Properties["AppPoolId"].Value = appPool;
IISVdir.CommitChanges();

The installer runs with no dialog (removed the installation address UI node) but the AppPool set on the virtual directory ends up being DefaultAppPool.

Other custom actions in my helper class do run and work.

So there must be some other magic incantations needed.

Thanks.

this seems to work from the command line:XYZZX.msi /qr /TARGETAPPPOOL="MyAppPoolName"Is it possible to set the TARGETAPPPOOL parameter in a custom action?
Okay, since the command line option worked, maybe this would:if (this.Context.Parameters.ContainsKey("TARGETAPPPOOL")) this.Context.Parameters["TARGETAPPPOOL"] = appPool;else{ this.Context.Parameters.Add("TARGETAPPPOOL", appPool);}Nope - still set to DefaultAppPool
I just had a similar problem. I could only solve it by getting by custom action to run at the Commit stage, instead of the Install stage.
Tim C

related questions