Visual Studio MSI 安装程序

发布于 2024-08-14 11:34:23 字数 100 浏览 4 评论 0原文

我有一个 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 技术交流群。

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

发布评论

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

评论(2

再可℃爱ぅ一点好了 2024-08-21 11:34:23

Visual Studio Web 安装项目是一个非常简单(而且不太灵活)的工具。不过,您有一些选择(假设您还没有准备好改用更灵活的东西,例如 WiX 或商业安装包装产品)。

生成后修改 MSI

一种方法是在生成 MSI 文件后对其进行修改。

您可以添加如下属性:

  1. 添加名为 TARGETSITE 的属性,并将其设置为您需要作为默认值的站点的元数据库路径。例如,/LM/W3SVC/2

  2. 添加名为 TARGETAPPPOOL 的属性,并将其设置为您需要作为默认值的应用程序池的名称。例如,MyAppPool

  3. 您还可以通过编辑现有的 ProductName 属性来设置产品名称。

可以使用 InstEdit 或 ORCA(它是 Windows SDK)。

或者,您可以创建/查找 MSBuild 任务来获取和设置 MSI 文件中的属性。这为您提供了一种在自动化构建期间自动进行所需更改的好方法。

使用命令行参数调用

更简单地说,您可以使用 msiexec.exe 从命令行调用安装,并指定 TARGETSITETARGETAPPPOOL 属性的值,例如

msiexec /i MySetup.msi TARGETSITE=/LM/W3SVC/2 TARGETAPPPOOL=Pool2

:不过,不要用这种方式搞乱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:

  1. 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.

  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.

  3. 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 and TARGETAPPPOOL properties, for example:

msiexec /i MySetup.msi TARGETSITE=/LM/W3SVC/2 TARGETAPPPOOL=Pool2

You can't mess about with the ProductName this way, though.

涫野音 2024-08-21 11:34:23

在 Orca 中打开 MSI。转到属性,右键单击并右键添加行。

属性:TARGETAPPPOOL
值:ASP.NET v4.0

您可以使用以下 VBS 脚本执行相同的操作:

Dim oDatabase 'As WindowsInstaller.Database
Const msiOpenDatabaseModeTransact = 1
Dim oInstaller 'As WindowsInstaller.Installer

Dim sFilePath 'As String
sFilePath = "C:\Test\MySetup.msi"
Set oInstaller = CreateObject("WindowsInstaller.Installer")
Set oDatabase = oInstaller.OpenDatabase(sFilePath, msiOpenDatabaseModeTransact)

sql = "INSERT INTO Property (Property, Value) VALUES ('TARGETAPPPOOL', 'ASP.NET v4.0')"    
Dim oView 'As WindowsInstaller.View
Set oView = oDatabase.OpenView(sql)
oView.Execute
oView.Close

oDatabase.Commit
MsgBox ("Done!")

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:

Dim oDatabase 'As WindowsInstaller.Database
Const msiOpenDatabaseModeTransact = 1
Dim oInstaller 'As WindowsInstaller.Installer

Dim sFilePath 'As String
sFilePath = "C:\Test\MySetup.msi"
Set oInstaller = CreateObject("WindowsInstaller.Installer")
Set oDatabase = oInstaller.OpenDatabase(sFilePath, msiOpenDatabaseModeTransact)

sql = "INSERT INTO Property (Property, Value) VALUES ('TARGETAPPPOOL', 'ASP.NET v4.0')"    
Dim oView 'As WindowsInstaller.View
Set oView = oDatabase.OpenView(sql)
oView.Execute
oView.Close

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