Visual Studio MSI 安装程序
我有一个 Web 设置项目安装程序,我想默认该站点和在安装过程中选择的应用程序池。另外,我希望在安装程序的构建过程中将产品名称附加到当前版本号。
任何帮助将不胜感激!谢谢
I have an Web Setup Project Installer and I would like to default the site and the Application Pool that is selected during the install process. Also I would like to have the name of the product append the current version number during the build process of the installer.
Any help would be greatly appreciated! Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Visual Studio Web 安装项目是一个非常简单(而且不太灵活)的工具。不过,您有一些选择(假设您还没有准备好改用更灵活的东西,例如 WiX 或商业安装包装产品)。
生成后修改 MSI
一种方法是在生成 MSI 文件后对其进行修改。
您可以添加如下属性:
添加名为
TARGETSITE
的属性,并将其设置为您需要作为默认值的站点的元数据库路径。例如,/LM/W3SVC/2
。添加名为
TARGETAPPPOOL
的属性,并将其设置为您需要作为默认值的应用程序池的名称。例如,MyAppPool
。您还可以通过编辑现有的
ProductName
属性来设置产品名称。可以使用 InstEdit 或 ORCA(它是 Windows SDK)。
或者,您可以创建/查找 MSBuild 任务来获取和设置 MSI 文件中的属性。这为您提供了一种在自动化构建期间自动进行所需更改的好方法。
使用命令行参数调用
更简单地说,您可以使用 msiexec.exe 从命令行调用安装,并指定
TARGETSITE
和TARGETAPPPOOL
属性的值,例如:不过,不要用这种方式搞乱
ProductName
。The Visual Studio Web Setup Project is quite a simple (and not too flexible) tool. You have some options, though (assuming you are not ready to switch to using something more flexible such as WiX or a commercial installation packaging product).
Modify the MSI After Building
One way to do what you want is to modify the MSI file after it has been built.
You can add properties such as the following:
Add a property named
TARGETSITE
and set it to the metabase path of the site you need to be the default. For example,/LM/W3SVC/2
.Add a property named
TARGETAPPPOOL
and set it to the name of the application pool you need to be the default. For example,MyAppPool
.You can also set the product name by editing the existing
ProductName
property.Making changes to MSI files can be achieved manually with tools such as InstEdit or ORCA (which is part of the Windows SDK).
Alternatively, you can create/find MSBuild tasks to get and set properties in MSI files. This gives you a nice way to automatically make the desired changes during automated builds.
Invoke with Commandline Arguments
More simply, you can invoke the installation from the command-line using msiexec.exe and specifying values for the
TARGETSITE
andTARGETAPPPOOL
properties, for example:You can't mess about with the
ProductName
this way, though.在 Orca 中打开 MSI。转到属性,右键单击并右键添加行。
属性:TARGETAPPPOOL
值:ASP.NET v4.0
您可以使用以下 VBS 脚本执行相同的操作:
Open the MSI in Orca. Go to Property, right click and right click to add Row.
Property: TARGETAPPPOOL
value: ASP.NET v4.0
You can do the same using this VBS script: