Hi @WUBBSY ,
Please check if the following solution helps.
https://stackoverflow.com/a/71890740/17334287
Problem with Visual Studio installer project and System.Management after .NET 6 upgrade
Hello,
I've wrote a simple WPF application for my company. It displays system information, installs printers and manages some settings.
Recently I used the Microsoft .NET Upgrade Assistant to upgrade my app from .NET 5 to .NET 6.
After fixing the NuGet package manager, which got broken through the upgrade assist, the app startet as normal and everything seemed fine.
But after Testing the installation the app threw errors and crashed. In my log I got the following error.
System.PlatformNotSupportedException: System.Management currently is only supported for Windows desktop applications.
I use System.Management to get system information and to handle printers.
When I just open the compiled exe, without the installer, the app works just fine without any problems.
I don't get how the installer convinces windows that my WPF GUI app is somehow a .NET Core application.
Sadly I could find many resources to Installer Projects and .NET 6.
- The App itself is set to Windows Application and .NET 6.0
- I use "Publish Items" instead of Primary output" in the installer
- I set the Prerequisites of the installer to ".NET Desktop Runtime 6.0.9 (x64)"
I can't find anywhere to say that this app is a Desktop app and not a Core app.
I created a simple .NET 6 App with a installer and it works with System.Management. But I can't find any differences.
I also added a new installer project to my solution but I get the same error.
The thing that gets me is that when starting the app from the build output it works just fine.
Is there any option that could cause this problem or do I have to rewrite the whole app with .NET 6 from the beginning?
Developer technologies | .NET | .NET Runtime
Developer technologies | C#
-
Jiachen Li-MSFT 34,231 Reputation points Microsoft External Staff
2022-10-13T08:15:07.323+00:00