Web 安装项目中的虚拟目录

发布于 2024-07-16 06:55:11 字数 97 浏览 8 评论 0原文

我有一个网络安装项目,默认情况下在文本框安装程序屏幕中显示虚拟目录。 我希望用户无法编辑虚拟目录名称,并且始终默认为我在 msi 中设置的虚拟目录名称。 如何才能实现这一目标?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

许仙没带伞 2024-07-23 06:55:11

如果您不希望用户更改虚拟目录,您只需从用户界面中删除“安装地址”对话框即可。

  1. 右键单击安装程序项目并
    选择“用户界面”。
  2. 展开“开始”节点。
  3. 右键单击“安装地址”。
  4. 选择“删除”

如果您想要通常由安装地址对话框选择的网站、虚拟目录、应用程序池的不同参数,您可以使用自定义操作进行覆盖,如其他人所述。

但是,根据我的经验,自定义操作无助于设置用户可以更改的默认值,因为它们在要求用户输入的对话框之后执行。

设置用户可以根据需要在对话框中覆盖的一些默认值的最简单方法是执行以下操作。

  1. 删除欢迎页面。
  2. 添加文本框对话框(例如“文本框 (A)”)
  3. 将所有文本框的可见属性更改为 false,以便不显示文本框。
  4. 更改 BannerBitmap 和 BodyText 属性,使其看起来有点像欢迎
    页。
  5. 在“编辑***属性”中设置您想要覆盖的必要属性
    并在“编辑
    ***值”中设置默认值。

最有用的属性(恕我直言)是。

TARGETDIR - 文件要复制到的位置。
TARGETVDIR - 要在指定站点中创建的虚拟目录。
TARGETAPPPOOL - 要使用的应用程序池(注意:它必须存在,不会被创建)
TARGETSITE - 要创建虚拟目录的网站(注意:这是网站的元数据库值...例如:“/LM/W3svc/ 2"。另请注意,该站点必须存在)。

您可以在此处找到安装程序的完整属性列表。

如果您确实想要更好地控制 IIS 设置,我建议将您的项目更改为标准 Windows Installer 项目并创建自定义安装操作,以便您可以以编程方式创建 AppPools。 此处是了解以编程方式创建这些内容的好地方。

这样做的最大原因是自定义操作提示之后运行,但应用程序池和网站必须在之前创建安装程序会提示。

If you don't want the user to change the virtual directory you can simply remove the "Installation Address" dialog from the User Interface.

  1. Right Click installer project and
    select "User Interface".
  2. Expand the "Start" node.
  3. Right click on "Installation Address".
  4. Select "Delete"

If you want different parameters for the Web site, virtual directory, application pool that is normally selected by the installation address dialog you can override with a custom action as others have described.

However, in my experience custom actions do not help with setting defaults that the user can change because they execute After the dialogs that ask for user input.

The easiest way to set some defaults that the user can override if necessary in a dialog is to do the following.

  1. Remove the Welcome Page.
  2. Add a Textboxes dialog (for example "Textboxes (A)")
  3. Change Visible properties for all the textboxes to false so no textboxes are shown.
  4. Change the BannerBitmap and BodyText property so it looks somewhat like a welcome
    page.
  5. Set the necessary properties you want to override in the "Edit***<n>Property"
    and set the default value in the "Edit
    <n>***Value".

The most useful properties (IMHO) are.

TARGETDIR - Where the files are to be copied.
TARGETVDIR - The Virtual Directory to be created in the specified site.
TARGETAPPPOOL - The application pool to use (NOTE: This must exist, it won't be created)
TARGETSITE - The website where the virtual directory is to be created (NOTE: This is the metabase value for the web site... For example: "/LM/W3svc/2". Also note that the site must exist).

There is a full list of properties for the installer can be found here.

If you really want better control over the IIS setup I would suggest changing your project to a standard Windows Installer project and creating custom Install actions so that you can programatically create AppPools. A good place to start to understand programmaticly creating these things is here.

The biggest reason for doing it this way is that custom actions run after prompting but the app pool and web sites must be created before the installer can prompt.

彡翼 2024-07-23 06:55:11

理论上听起来不错,但据我所知,不起作用,至少对于设置 AppPool 不起作用。 我有一个自定义操作来在我的 vs2008 Web 设置项目中设置应用程序池(顺便说一下,当使用 VS2005 构建安装程序时,它可以正常工作)。

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

安装程序在没有对话框的情况下运行(删除了安装地址 UI 节点),但虚拟目录上设置的 AppPool 最终成为 DefaultAppPool。

我的助手类中的其他自定义操作确实可以运行和工作。

所以肯定还需要一些其他的魔法咒语。

谢谢。

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.

一个人的旅程 2024-07-23 06:55:11

为了使用 Context.Parameters 获取虚拟目录,

  1. 请添加自定义操作以安装节点(使用此 url 如果您想知道如何添加自定义操作)
  2. 右键单击自定义操作并选择属性窗口。
  3. 对于 CustomActionsData 属性,设置 /targetvdir="[TARGETVDIR]"。
  4. 现在,在安装程序类中,您可以通过 Context.Parameters["targetvdir"] 获取虚拟目录名称。
    希望这对您有帮助:)

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 :)
如梦亦如幻 2024-07-23 06:55:11

Org不允许开源,或者GPL开源。

解决方案:
* 编辑自定义操作(右键>查看>自定义操作)以修复虚拟目录和路径
将 customactiondata 更改

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

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

:您可能只需从用户界面中删除安装地址,然后设置一个将信息传递到自定义安装的组件

  • 使用 msbuildtasks 编写 msbuild 的包装器

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
浅忆流年 2024-07-23 06:55:11

选择您的安装项目,查看> 编辑> 用户界面,选择安装地址对话框,然后将其删除。

编辑:

正如 Shay 指出的那样,用户可以从命令行覆盖默认安装位置。 要覆盖此设置,您应该在 InstallExecuteSequence 中设置 TARGETDIR 属性。 不幸的是,您无法从 Visual Studio 更改此顺序,您必须使用 Orca:

  1. 构建您的安装项目。
  2. 从 Orca 打开 MSI 文件。
  3. 创建类型 51(设置属性)的新自定义操作,其中源为“TARGETDIR”(不带引号)、目标文件夹的目标以及操作的唯一名称(约定是使用以下划线开头的 GUID)。
  4. 在 InstallExecuteSequence 中创建一个新行,其中包含操作的唯一名称、条件的“NOT Installed”以及使用 TARGETDIR 之前的序列号(750 是我制作的示例中的第一次使用,因此我使用了 555 的序列) 。

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).
温柔戏命师 2024-07-23 06:55:11

切换到 Wix 并使用他们的 网络扩展

Switch to Wix and use their Web Extensions

家住魔仙堡 2024-07-23 06:55:11

低技术解决方案:在notepad++中编辑vdproj文件以设置虚拟目录并从用户界面编辑器中删除“安装地址”对话框。

Lo-tech solution: edit the vdproj file in notepad++ to set the virtual directory and remove the Installation Address dialog from the User Interface Editor.

青春如此纠结 2024-07-23 06:55:11

对于我来说,在 VS

  1. 右键单击安装项目

  2. 查看 -> 文件系统

  3. Web 应用程序文件夹(位于左窗格中)

  4. 在属性窗口中(右侧、底部)

  5. 虚拟目录(最后一个)

    在这里您可以更改/设置IIS上的默认路径,即可以安装的目标目录。

For me in VS

  1. Right click on setup project

  2. View -> File System

  3. Web Application Folder (in the left pane)

  4. in the property window (to the right, bottom)

  5. Virtual Directory (the last one)

    Here you can change/set the default path on IIS i.e. target directory which can be installed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文