I'm working on a WPF project that targets .NET Framework 4.8
1/
Now I'm researching about running that application with .NET 7 but is it possible to do that?
For example, I tried dotnet wpf.exe
but it shown some errors
A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Users\admin\Documents\Debug\'.
Failed to run as a self-contained app.
- The application was run as a self-contained app because 'C:\Users\admin\Documents\Debug\wpf.runtimeconfig.json' was not found.
- If this should be a framework-dependent app, add the 'C:\Users\admin\Documents\Debug\wpf.runtimeconfig.json' file and specify the appropriate framework.
This is some info about the environment (from dotnet --info
)
I've installed a new Windows 10 22H2 so I think .NET Framework 4.8 is included
.NET SDK:
Version: 7.0.101
Commit: bb24aafa11
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.101\
Host:
Version: 7.0.1
Architecture: x64
Commit: 97203d38ba
.NET SDKs installed:
7.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
2/
If the above is impossible, is there a way to build the .NET Framework project so it can run with .NET 7 without changing (migrating) the current project structure? (Something like I can continue working on .NET Framework project as before then use a specific dotnet
command to build it to .NET 7 executable. Assuming all packages are compatible with .NET 7)