I have a Wix Custom Action DLL that is used in multiple installer projects. I'd like to deploy this DLL to our nuget repository so it is easier to share. However, the dotnet pack
command doesn't put the correct DLL in the package. The project builds 2 DLLs. WixInstallTools.dll
and WixInstallTools.CA.dll
. I'm not actually sure if installer projects need both DLLs or not, but they certainly need WixInstallTools.CA.dll
. How do I get this CA DLL into the nuget package. I'm using Wix4 in a Visual Studio 2022 environment. The following is my project file.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputPath>bin\$(Configuration)\$(Platform)</OutputPath>
<Version>1.0.0.0</Version>
<Authors>author</Authors>
<Company>company</Company>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<DebugType>embedded</DebugType>
<PackageId>WixInstallTools</PackageId>
<PackageDescription>Wix Custom Action Library</PackageDescription>
<PackageTags>WixInstallTools;Wix Install Tools;Wix;Install;Tools</PackageTags>
<RepositoryUrl>https://github.com/company/nuget</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<Content Include="CustomAction.config" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Dtf.CustomAction" Version="4.0.4" />
<PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.4" />
</ItemGroup>
<ItemGroup>
<Reference Include="PresentationFramework" />
<Reference Include="System.DirectoryServices.AccountManagement" />
</ItemGroup>
</Project>
So I ended up brute forcing this solution for myself. I decided to hand craft a .nuspec file and fed that into nuget. There might be more elegant "supported" ways of doing this, but I just got tired of fighting with it. Here is my .nuspec file:
<?xml version="1.0" encoding="utf-8"?>
<package >
<metadata>
<id>WixInstallTools</id>
<version>1.0.0.0</version>
<authors>author</authors>
<tags>WixInstallTools Wix Install Native</tags>
<description>install library</description>
<dependencies>
</dependencies>
</metadata>
<files>
<file src="WixInstallTools.CA.dll" target="runtimes/win-x64/native"/>
</files>
</package>