如何在 BeforeBuild Exec 中使用 msbuild?

How to use msbuild inside BeforeBuild Exec?

我有一个 Wix 安装程序项目需要 运行 msbuild 才能生成 .dll 文件和可执行文件,我目前在我的项目中有这样的项目:

<Target Name="BeforeBuild">
    <!-- Publish dotnet core app -->
    <Exec Command="msbuild /p:configuration=release ..\Regulator2App.WPF\Regulator2App.WPF.csproj" />
    ...
</Target>

当我构建安装程序项目时,出现以下错误:

The attribute "Version" in element <PackageReference> is unrecognized.  Regulator2App.Installer C:\Users\Iván\Desktop\regulator2app\Regulator2App\Regulator2App\Regulator2App.csproj

指向这一行:

<ItemGroup>
   <PackageReference Include="GuerrillaNtp" Version="1.4.1" />
   ...
</ItemGroup>

然后命令以代码 1 退出。

如何将 msbuild 命令添加到我的安装程序中?需要什么 added/changed?

我的设置与 this tutorial.

完全相同

我个人创建了一个 Application.sln 和一个 Installer.sln 并构建了前者和后者。我在 https://github.com/iswix-llc/iswix-tutorials.

的教程中谈到了它