如何将 Nuget 包 dll 添加到 Wix 安装程序

How to Add Nuget package dlls to Wix installer

如何将 Nuget 包 dll 添加到 Wix 安装程序。 我尝试添加

<?define SourceDirectory = $(var.SolutionDir)\ProjectName\bin\Release" ?>

   <Component Id="cmpId1"  Guid="BF985D52-BA8C-4E4F-84CC-B5A95520FBD4">
      <File Id="fileId1" KeyPath="yes" Source="$(var.SourceDirectory)\Unity.Abstractions.dll" />
   </Component>

但不工作。

请指导我如何将 nuget 包 dll 添加到 wix 安装程序。

谢谢, 纳文

创建一个空的新项目(库)并在这个新项目中安装 nuget-package。在您的设置中,您收集安装了 nuget-package 的新项目的构建输出。

<Component Id="cmpId1"  Guid="BF985D52-BA8C-4E4F-84CC-B5A95520FBD4">
      <File Id="fileId1" KeyPath="yes" Source="$(var.NugetCollectorProject.TargetDir)\Unity.Abstractions.dll" />
   </Component>

NugetCollectorProject 是新项目。您的安装程序必须引用该项目才能使用 var.projectname.targetdir