WPF app that has multiple targets

%3CLINGO-SUB%20id%3D%22lingo-sub-1304103%22%20slang%3D%22en-US%22%3EWPF%20app%20that%20has%20multiple%20targets%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1304103%22%20slang%3D%22en-US%22%3E%3CP%3EHello.%20I%20am%20currently%20trying%20to%20package%20up%20a%20WPF%20application%20I%20have%20and%20I%20have%20run%20into%20a%20wall%20and%20can't%20figure%20out%20what%20to%20do%20next%20besides%20give%20up.%20My%20app%20targets%20.Net%20Framework%204.8%20and%20.Net%20Core%203.1%20and%205.0%20Preview.%20When%20building%20the%20package%20project%20after%20adding%20my%20application%20to%20it%20I%20get%20an%20error%20message%20that%20%22Project%20targets%20'net48%3Bnetcoreapp3.1%3Bnetcoreapp5.0'%20and%20it%20cannot%20be%20referenced%20by%20a%20project%20that%20targets%20.NetCore%2CVersion%3D5.0.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20can%20I%20fix%20this%3F%20Is%20there%20a%20way%20to%20tell%20the%20package%20project%20to%20create%20a%20package%20for%20each%20framework%3F%20Does%20this%20only%20work%20if%20your%20app%20targets%20a%20single%20.Net%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1311039%22%20slang%3D%22en-US%22%3ERe%3A%20WPF%20app%20that%20has%20multiple%20targets%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1311039%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F620047%22%20target%3D%22_blank%22%3E%40mylastsong18%3C%2FA%3E%26nbsp%3BYou%20can%20fix%20that%20error%20by%20adding%20this%20to%20your%20.wapproj%20file%3A%3C%2FP%3E%0A%3CDIV%3E%0A%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%26lt%3B%3C%2FSPAN%3E%3CSPAN%3EPropertyGroup%3C%2FSPAN%3E%3CSPAN%3E%26gt%3B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%26lt%3B%3C%2FSPAN%3E%3CSPAN%3EAssetTargetFallback%3C%2FSPAN%3E%3CSPAN%3E%26gt%3B%3C%2FSPAN%3E%3CSPAN%3E%24(AssetTargetFallback)%3Bnetcoreapp3.1%3Bnetcoreapp3.0%3Bnetcoreapp2.0%3Bnet462%3Bnet47%3Bnet471%3Bnet472%3Bnet48%3C%2FSPAN%3E%3CSPAN%3E%3CSPAN%3EAssetTargetFallback%3C%2FSPAN%3E%3CSPAN%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%3CSPAN%3EPropertyGroup%3C%2FSPAN%3E%3CSPAN%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3EHowever%2C%20this%20will%20still%20not%20work%20as%20you%20intend.%26nbsp%3B%20The%20packaging%20project%20was%20not%20built%20with%20the%20idea%20that%20you%20could%2Fwould%20build%20a%20.msix%20package%20for%20different%20frameworks%2C%20only%20different%20platforms%20(x86%2Fx64%2Fetc...)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3EJust%20so%20I%20can%20understand%20what%20you%20are%20trying%20to%20do%20fully%2C%20how%20would%20you%20expect%20a%20.msix%20would%20work%20with%20different%20framework%20applications%20in%20it%20from%20a%20customer%20perspective%3F%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1372189%22%20slang%3D%22en-US%22%3ERe%3A%20WPF%20app%20that%20has%20multiple%20targets%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1372189%22%20slang%3D%22en-US%22%3ESorry%20it%20took%20me%20so%20long%20to%20reply.%20I%20have%20given%20up%20on%20using%20MSIX%20so%20it%E2%80%99s%20fine%20but%20I%E2%80%99ll%20keep%20that%20in%20mind%20for%20the%20future.%3CBR%20%2F%3E%3CBR%20%2F%3EMy%20original%20goal%20was%20never%20to%20create%20a%20single%20package%20but%20instead%20a%20package%20for%20each%20of%20the%20different%20frameworks%20I%20target.%20In%20my%20csproj%20I%20am%20able%20to%20specify%20that%20I%20want%20to%20AppendTargetFrameworkToOutputPath%20so%20I%20suppose%20I%20was%20looking%20for%20something%20like%20that%20in%20MSIX%3C%2FLINGO-BODY%3E
New 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