如何使用Visual Studio在MSI文件中嵌入文件版本?

时间:2021-12-16 00:38:03

I have a setup project for my C# program, and this setup project has a Version in its properties. I'd like for the MSI file that is generated to have this Version embedded in it, so I can mouse over it in explorer and see what version the file is.

我有一个用于我的C#程序的安装项目,这个安装项目在其属性中有一个版本。我想生成的MSI文件嵌入了这个版本,所以我可以在资源管理器中将鼠标悬停在它上面,看看该文件是什么版本。

I'm using VS2008. How can I do this?

我正在使用VS2008。我怎样才能做到这一点?

5 个解决方案

#1


6  

If you simply add the "Version: 1.5.0" text into the Description property of the Setup Project, the version number also shows on the MSI file like so:

如果只是将“Version:1.5.0”文本添加到Setup Project的Description属性中,版本号也会显示在MSI文件中,如下所示:

http://screencast.com/t/A499i6jS

#2


1  

That's a good question but I don't know any setup tool that could do that. Moreover I never encountered an MSI file with file version resource embedded in it, so it's not a common practice. Usually if I want to find out version of an MSI file I have to open it in Orca and check ProductVersion property there (in Property table).

这是一个很好的问题,但我不知道任何可以做到这一点的设置工具。此外,我从未遇到过嵌入了文件版本资源的MSI文件,因此这不是常见做法。通常,如果我想查找MSI文件的版本,我必须在Orca中打开它并在那里检查ProductVersion属性(在Property表中)。

#3


1  

As far as I know MSI file will never show version. Simple reason is that MSI files are not PE files, they are sort-of database. Msiexec.exe then interprets this database to do the actual installation. The version property you mention is used by MSI engine internally for upgrades, uninstalls etc and is never displayed.

据我所知,MSI文件永远不会显示版本。简单的原因是MSI文件不是PE文件,它们是排序数据库。然后Msiexec.exe解释此数据库以执行实际安装。您提到的版本属性由MSI引擎在内部用于升级,卸载等,并且永远不会显示。

#4


1  

Open up the associated .vdproj file in a text editor. Look for the "Product" section, then modify the "ProductVersion", and the "Manufacturer" fields.

在文本编辑器中打开关联的.vdproj文件。查找“产品”部分,然后修改“ProductVersion”和“Manufacturer”字段。

 "Product"
    {
    "Name" = "8:Microsoft Visual Studio"
    "ProductName" = "8:tidAxCleanupScript"
    "ProductCode" = "8:{0949AAAD-2C29-415E-851C-825C74C9CA81}"
    "PackageCode" = "8:{8F012EF1-D5D0-43DC-BBFD-761A639DDB07}"
    "UpgradeCode" = "8:{38DE1949-0782-4EF3-BDC2-080EB5B73EF8}"
    "RestartWWWService" = "11:FALSE"
    "RemovePreviousVersions" = "11:TRUE"
    "DetectNewerInstalledVersion" = "11:TRUE"
    "InstallAllUsers" = "11:FALSE"
    "ProductVersion" = "8:**1.5.0**"
    "Manufacturer" = "8:**Default Company Name**"
    "ARPHELPTELEPHONE" = "8:"

#5


0  

I might be wrong, but doesn't the msi version follow the version in the AssemblyInfo file of your startup project?

我可能错了,但msi版本是否遵循启动项目的AssemblyInfo文件中的版本?

#1


6  

If you simply add the "Version: 1.5.0" text into the Description property of the Setup Project, the version number also shows on the MSI file like so:

如果只是将“Version:1.5.0”文本添加到Setup Project的Description属性中,版本号也会显示在MSI文件中,如下所示:

http://screencast.com/t/A499i6jS

#2


1  

That's a good question but I don't know any setup tool that could do that. Moreover I never encountered an MSI file with file version resource embedded in it, so it's not a common practice. Usually if I want to find out version of an MSI file I have to open it in Orca and check ProductVersion property there (in Property table).

这是一个很好的问题,但我不知道任何可以做到这一点的设置工具。此外,我从未遇到过嵌入了文件版本资源的MSI文件,因此这不是常见做法。通常,如果我想查找MSI文件的版本,我必须在Orca中打开它并在那里检查ProductVersion属性(在Property表中)。

#3


1  

As far as I know MSI file will never show version. Simple reason is that MSI files are not PE files, they are sort-of database. Msiexec.exe then interprets this database to do the actual installation. The version property you mention is used by MSI engine internally for upgrades, uninstalls etc and is never displayed.

据我所知,MSI文件永远不会显示版本。简单的原因是MSI文件不是PE文件,它们是排序数据库。然后Msiexec.exe解释此数据库以执行实际安装。您提到的版本属性由MSI引擎在内部用于升级,卸载等,并且永远不会显示。

#4


1  

Open up the associated .vdproj file in a text editor. Look for the "Product" section, then modify the "ProductVersion", and the "Manufacturer" fields.

在文本编辑器中打开关联的.vdproj文件。查找“产品”部分,然后修改“ProductVersion”和“Manufacturer”字段。

 "Product"
    {
    "Name" = "8:Microsoft Visual Studio"
    "ProductName" = "8:tidAxCleanupScript"
    "ProductCode" = "8:{0949AAAD-2C29-415E-851C-825C74C9CA81}"
    "PackageCode" = "8:{8F012EF1-D5D0-43DC-BBFD-761A639DDB07}"
    "UpgradeCode" = "8:{38DE1949-0782-4EF3-BDC2-080EB5B73EF8}"
    "RestartWWWService" = "11:FALSE"
    "RemovePreviousVersions" = "11:TRUE"
    "DetectNewerInstalledVersion" = "11:TRUE"
    "InstallAllUsers" = "11:FALSE"
    "ProductVersion" = "8:**1.5.0**"
    "Manufacturer" = "8:**Default Company Name**"
    "ARPHELPTELEPHONE" = "8:"

#5


0  

I might be wrong, but doesn't the msi version follow the version in the AssemblyInfo file of your startup project?

我可能错了,但msi版本是否遵循启动项目的AssemblyInfo文件中的版本?