msix-packaging: [BUG] Build fails trying to create .msixbundle for a .NET 7.0 desktop app
Project MSIX SDK or Win7Msix
Describe the bug
Cannot create .msixbundle for .NET 7.0 desktop app.
To Reproduce Steps to reproduce the behavior:
- load the attached solution: WpfApp1.zip
- build it
- right click WapProjTemplate1 -> Publish -> Create app packages
Notice that the build for "Configuration: Debug Any CPUis attempting to build with/platform:x86 ` and so the packaging fails with "1>There was a mismatch between the processor architecture of the project being built “MSIL”…
This does not happen when using .NET 4.8. In this case the build does build
Expected behavior
It should “just work”.
Screenshots
Platform
Windows 11, VS 2022, .NET 7.0
Additional context
I isolated this from the real app that I’m building where you can see the MyMoneyPackage project working on .NET 4.8:
In the master branch. If you checkout the “net7” branch then you will see this error.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 15 (8 by maintainers)
I really don’t understand this. Why does it have to assume self-contained, when it can work as a framework-dependent app? Can this option be added?
Ok, if you know the risks, you can accomplish what you want it might just be a little clunky.
You will need to create a publish profile (.pubxml) in your .NET7 app, you can do this through the UI by going through the “Publish” option and creating a new Folder publish profile. You will notice this has options for Self contained or framework dependent.
Then in the Windows Application Packaging Project if you select the project reference to your .NET7 application:
in the property window you will see a property called “Publishing Profile” which you will set to the publish profile you created in the .NET7 app.
You will end up with this in the .wapproj file:
You would probably want to remove the Condition or modify it to suit your needs based on the publish profile properties you specified.
Then in the publish dialog, you would still need to select x86/x64/ARM, but your .NET7 app would be built using whatever platform you specified in the publish profile.