Windows Application Packaging Project of .NET 462 desktop application missing dependencies

50 Views Asked by At

I am trying to package an existing C# .NET 462 application into a MSIX application. It mostly works, but it is missing a bunch of dependencies from certain NuGet packages.

The pattern I noticed when figuring out why some dependencies were missing was that the ones that were copied correctly to the output either follow the officially documented layout for NuGet package or use a .targets file in the build directory with the following content:

NuGet package layout

build
  |-- net462
        |-- Nuget.Name.targets
        |-- Content
               |-- ... files ...
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <None Include="$(MSBuildThisFileDirectory)Content\Package.dll.config">
      <Link>Package.dll.config</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Visible>false</Visible>
    </None>
    ...
  </ItemGroup>
</Project>

However, the ones that do not get copied to the output directory of the Windows Application Packaging Project, also located in the build directory, follow this way of doing it:

NuGet package layout

build
  |-- NuGet.Package.targets
  |-- CompanyContents
            |-- ... files ... // DOES NOT GET COPIED TO WAPP OUTPUT
  |-- lib  // DOES GET COPIED TO WAPP OUTPUT
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <CompanyContentFiles Include="$(MSBuildThisFileDirectory)..\CompanyContents\**\*" />
  </ItemGroup>
  <Target Name="companyContentsCopy" AfterTargets="Build" Inputs="%(CompanyContentFiles.identity)" Outputs="$(OutputPath)%(CompanyContentFiles.RecursiveDir)%(CompanyContentFiles.Filename)%(CompanyContentFiles.Extension)">
    <Copy SourceFiles="%(CompanyContentFiles.identity)" DestinationFolder="$(OutputPath)\%(CompanyContentFiles.RecursiveDir)" SkipUnchangedFiles="true" />
  </Target>
</Project>

It all works when compiling it as a regular desktop application, but when packaging it in an MSIX through the Windows Application Packaging Project it does not.

Can anyone explain why one method works while the other does? And, perhaps more importantly, can point to some documentation? After days I have been unable to find any answers to this or find a satisfactory answer. My own guess would be that MSIX has more strict requirements for NuGet packages, but I have been unable to find anything to substantiate this guess.

Any help would be much appreciated.

0

There are 0 best solutions below