I am looking to write my first C# CustomAction project in .net7 using Wix4.
I have a very simple class in the project with one function decorated with the CustomAction attribute.
The reading that I have carried out, as well as a clone of the Wix4 repo suggested I just needed to add the following NuGet reference to my cs project file.
When I come to compile I get two errors:
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.
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
(Reported as an error in WixToolset.Dtf.CustomAction.targets code MSB3073)
As per sample CA project in the Wix4source, I have just one NuGet package reference to WixToolset.Dtf.CustomAction - though I can't get the Wix4 Custom Action project to build in VS2022 either.
<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>
I have a test class as follows in the project:
using WixToolset.Dtf.WindowsInstaller;
namespace TestCustomAction
{
public static class DemoCustomAction
{
[CustomAction]
public static ActionResult TestAction(Session session)
{
return ActionResult.Success;
}
}
}