I have a fairly complex WPF Prism app that I'm in the process of porting from NETFX to .NET 5.
The app is compiled and Post Build events copy project outputs to a root ApplicationDebug
or ApplicationRelease
. Prism loads the Modules on demand so the loose coupling really borked the upgrade path by confusing the tooling.
I've managed to get to a point where it's compiling. I've also got it to a point where it's now producing an .exe during Debug build as per old .NET.
My property group looks like this:
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>...</AssemblyOriginatorKeyFile>
<PlatformTarget>x86</PlatformTarget>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..</SolutionDir>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.0</ApplicationVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PublishSingleFile>true</PublishSingleFile>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>
I then Debug this version in the Applicationxxxx
directory by setting the Debug target to Executable
rather than Project
.
The issue is it always errors with:
The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core.
The program '[37744] XXX.exe' has exited with code -2147450726 (0x8000809a).
As you can see the app is forcing to x86
, this was compiling fine, even though I didn't have the x86 SDK installed. So I tried installing that so that the x86 runtime would be installed (in case it wasn't already). but the error persists.
The usual fix to this is that the runtime isn't installed but I've already installed it. Has anyone encountered a similar situation and solved this?
If I compile with public static void Main()
in my App.cs
it complains of two main methods. If I take mine out of the code, it complains there aren't any Main
methods.
question from:
https://stackoverflow.com/questions/65934855/wpf-prism-updated-to-net-5-unable-to-start-not-raising-coreclr-started-event 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…