我有一个使用 Serilog 的非常简单的 C# Windows 窗体应用程序。我想使用 WIX 为我的应用程序创建一个 MSI 安装程序,并且我想在其中包含一些 Serilog DLL。
到目前为止,我已成功配置 Product.WXS 以复制所有三个 Serilog 文件;但是,在此过程中会覆盖若干文件元数据,包括文件版本和产品版本。
这是有道理的(我认为?),因为这些文件作为我的产品的组件包含在内,所以它们就像我的 EXE 一样得到版本控制。
结果,当我运行我的应用程序时,我收到一个 File or Assembly Not Found 错误(因为我的应用程序正在寻找一个与 MSI 安装后版本不同的 Serilog DLL)。
我确定我在这里遗漏了一些非常简单的东西。
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="MyProject" Language="1033" Version="1.0.0" Manufacturer="Acme, Inc" UpgradeCode="36202e76-0c43-492e-98d8-f9ff7e402f55">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="MyProjectInstallDir" >
<Component Id="ProductComponent">
<File Id="MYPROJECT_EXE" Name="MyProject.exe" Source="$(var.MyProject.TargetPath)"/>
</Component>
<Component Id="Serilog_dll" >
<File Id="Serilog_dll" Name="Serilog.dll" KeyPath="yes" Source="$(var.MyProject.TargetPath)" />
</Component>
<Component Id="Serilog_Sinks_dll" >
<File Id="Serilog_Sinks_File_dll" Name="Serilog.Sinks.File.dll" Source="$(var.MyProject.TargetPath)" />
</Component>
<Component Id="Serilog_Sinks_xml">
<File Id="Serilog_Sinks_File_xml" Name="Serilog.Sinks.File.xml" Source="$(var.MyProject.TargetPath)"/>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="ProductFeature" Level="1">
<ComponentRef Id="ProductComponent"/>
<ComponentRef Id="Serilog_dll"/>
<ComponentRef Id="Serilog_Sinks_dll"/>
<ComponentRef Id="Serilog_Sinks_xml"/>
</Feature>
</Product>
</Wix>
我期望的是所有三个 Serilog 文件都由 MSI 安装,并且它们具有正确的版本号和元数据。
基本上,我想做的是“复制”文件而不对它们进行版本控制。
就像我说的,我毫不怀疑这是可能的,而且可能是直截了当的,我只是 WIX 的新手。