Dav*_*d H 5 custom-action wix4
我希望使用 Wix4 在 .net7 中编写我的第一个 C# CustomAction 项目。
我的项目中有一个非常简单的类,其中一个函数用 CustomAction 属性装饰。
我进行的阅读以及 Wix4 存储库的克隆表明我只需将以下 NuGet 引用添加到我的 cs 项目文件中。
当我编译时,出现两个错误:
Invalid argument: WixToolset.Dtf.WindowsInstaller.dll must be included in the list of support files.
If using the MSBuild targets, make sure the assembly reference has the Private (Copy Local) flag set.
Run Code Online (Sandbox Code Playgroud)
The command ""******\..\tools\WixToolset.Dtf.MakeSfxCA.exe" "*****" "****\.nuget\packages\wixtoolset.dtf.customaction\4.0.1\build\..\tools\x86\SfxCA.dll" "****\obj\Debug\net7\****.dll" "****\obj\Debug\net7\****.CA.rsp"" exited with code 1
Run Code Online (Sandbox Code Playgroud)
(在 WixToolset.Dtf.CustomAction.targets 代码 MSB3073 中报告为错误)
根据 Wix4source 中的示例 CA 项目,我只有一个对 WixToolset.Dtf.CustomAction 的 NuGet 包引用 - 尽管我也无法在 VS2022 中构建 Wix4 自定义操作项目。
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Dtf.CustomAction" Version="4.0.1" />
</ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
我的项目中有一个测试类如下:
using WixToolset.Dtf.WindowsInstaller;
namespace TestCustomAction
{
public static class DemoCustomAction
{
[CustomAction]
public static ActionResult TestAction(Session session)
{
return ActionResult.Success;
}
}
}
Run Code Online (Sandbox Code Playgroud)
因此,经过大量挖掘后,结论是我不应该使用 .net7 或 .net 的任何核心版本。FireGiant 提供了一个 Wix4 自定义操作项目模板,作为其 Heatwave 产品的一部分。这仅使用.Net Framework。我现在已在 .Net Framework 4.8 上启动并运行我的自定义操作项目。这是一个遗憾,因为我的解决方案中的所有其他 C# 项目都是 .net7。