I have the same problem with desktop application (target framework is net8.0).
The Debug configuration runs without any problem. But Release configuration suddenly gives the following error:
My application uses Microsoft.NETCore.App framework version 8.0.10:
Output of 'dotnet --list-runtimes' command is:
Microsoft.AspNetCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
My project is located in regular folder, not OneDrive.
Here is the content of MyApp.runtimeconfig.json file located in the output Release folder near MyApp.exe:
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.InteropServices.BuiltInComInterop.IsSupported": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false,
"System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault": false
}
}
}