Ultratrunks
Ultratrunks

Reputation: 2584

How to get the additional CA dll from a Wix Custom Action build into a nuget package?

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>

Upvotes: 0

Views: 273

Answers (2)

Ultratrunks
Ultratrunks

Reputation: 2584

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>

Upvotes: 0

Christopher Painter
Christopher Painter

Reputation: 55601

The .CA.dll (native PE) contains the .DLL (.NET Framework Assembly). This would be considered a native runtime dependency.

If it's possible... this page will explain how.

https://learn.microsoft.com/en-us/nuget/create-packages/native-files-in-net-packages

Now what you could also do is turn your custom actions into a full blown WiX extension. Those get distributed as managed DLLs and are build time references for the compiler. Take a look at the repos for extensions such as IIS, Util and others.

Upvotes: 0

Related Questions