WPF app that has multiple targets

Copper Contributor

Hello. I am currently trying to package up a WPF application I have and I have run into a wall and can't figure out what to do next besides give up. My app targets .Net Framework 4.8 and .Net Core 3.1 and 5.0 Preview. When building the package project after adding my application to it I get an error message that "Project targets 'net48;netcoreapp3.1;netcoreapp5.0' and it cannot be referenced by a project that targets .NetCore,Version=5.0.

 

How can I fix this? Is there a way to tell the package project to create a package for each framework? Does this only work if your app targets a single .Net?

2 Replies

@mylastsong18 You can fix that error by adding this to your .wapproj file:

  <PropertyGroup>
    <AssetTargetFallback>$(AssetTargetFallback);netcoreapp3.1;netcoreapp3.0;netcoreapp2.0;net462;net47;net471;net472;net48</AssetTargetFallback>
  </PropertyGroup>
 
However, this will still not work as you intend.  The packaging project was not built with the idea that you could/would build a .msix package for different frameworks, only different platforms (x86/x64/etc...)
 
Just so I can understand what you are trying to do fully, how would you expect a .msix would work with different framework applications in it from a customer perspective?
Sorry it took me so long to reply. I have given up on using MSIX so it’s fine but I’ll keep that in mind for the future.

My original goal was never to create a single package but instead a package for each of the different frameworks I target. In my csproj I am able to specify that I want to AppendTargetFrameworkToOutputPath so I suppose I was looking for something like that in MSIX