Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
292 views
in Technique[技术] by (71.8m points)

c# - WPF Prism Updated to .NET 5 Unable to Start - Not Raising CoreCLR started event

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

So I've gotten a bit further with this. I ended up completely rebuilding the EXE project within the solution.

However, this is a complex loosely bound Prism app meaning the deployment turned into a nightmare. .NET doesn't really seem to support directory probing yet either.

I also started running into other deployment issues with 3rd party DLLs I rely on. Basically, I've given up for now. All the issues I was running into sort of had work-arounds but they're all hacks at the end of the day.

The main issue is that I can't seem to get a working debuggable application out of the build process. Throw in all the randomness from 3rd parties and it all went south.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...