c# - (我可以/我如何)从 WiX 访问程序集信息
问题描述
我正在学习如何使用 WiX 为我的项目创建安装程序,并希望能够引用我的 VS2019 C# 项目的程序集信息,这些信息是从我的 .wxs 文件中的项目属性 > 应用程序 > 程序集信息按钮填充的。
我知道我可以使用添加项目作为参考,然后使用$(var.MyProject.???)
声明,但我不知道在哪里可以找到项目的可行点符号属性列表。或者,我知道我可以使用 '' with<Package Manufacturer="$(var.CompanyName)" .../>
来省去多次输入数据的麻烦,但我仍然更愿意将它从项目中拉出来并放在一个地方。
谢谢
SEO 术语:wix 汇编版本。蜡组装信息
解决方案
Light.exe:在此处查看 WiX light.exe 文档: https ://wixtoolset.org/documentation/manual/v3/overview/light.html#standard-binder-variables
如果您想将主程序集的版本作为设置的 ProductVersion 运行,您应该能够执行以下操作:
<Product Id="*" Name="MyProject" Version="!(bind.fileVersion.MyMain.exe)"
Manufacturer="MyCorp" Language="1033" UpgradeCode="PUT-GUID-HERE">
<..>
<Component Feature="Main">
<File Id="MyMain.exe" Source="MyMain.exe"></File>
</Component>
WiX 示例:在此处完成 Github.com 示例。
和可用于所有版本化的二进制文件fileLanguage
。fileVersion
Dot NET 程序集支持许多其他变量 -请参阅文档(与答案顶部的链接相同)。
Rob Mensching: WiX 的创建者 Mensching 在这里给出了答案。精华:"You can drive your product version off of an assembly's version using "!(bind.assemblyVersion.FileId)". ... You can only specify binder variables in .wxs files. It's a binder (in light.exe) concept not an MSBuild (in MSBuild.exe reading .wixproj files) concept"
Heath Stewart:请查看此博客以获取有关 .NET 程序集值的一些信息:
https ://devblogs.microsoft.com/setup/get-binder-variables-for-assemblies-without-installing-into-the-gac/ - Essence:"...to get binder variables for assemblies without installing into the GAC set File/@Assembly to “.net” or “win32”, then for the same file set File/@AssemblyApplication to the value for File/@Id"
链接:
- https://wixtoolset.org/documentation/manual/v3/overview/preprocessor.html
- WiX (Windows Installer Xml),创建通用变量(
preprocessor variables
,localization variables
,etc...
)
推荐阅读
- laravel-5 - Laravel 5 双语产品模型
- bash - 运行 bash 脚本而不是单个文件执行两个
- sql - 带有随机 NEWID 列的临时表 T-SQL
- ansible - 将多个默认变量从 Chef 转换为 Ansible
- c# - ASP.NET Core Identity GenerateTwoFactorTokenAsync 返回空字符串
- php - 如何在 Drupal 8 中为子菜单设置自定义类?
- c# - 包与 netcoreapp2.2 不兼容
- javascript - Javascript:确定参数是否传递给函数
- r - R - colMeans(wind.speed,na.rm = T)中的错误:'x'必须是数字
- angular - spinner inside button has incorrect color