从.NET核心应用程序启动WPF应用程序 [英] Start WPF Application from .NET core App
问题描述
大家好。
我遇到了一个问题,我无法从.NET Core应用程序运行WPF应用程序。我想使用简单的WPF应用程序作为虚拟RasberryPI,只是为了查看.NET核心控制台应用程序是否正确设置了I / O引脚。这个虚拟对象仅用于更快地进行开发。
稍后我会用正确的RasberryPi驱动程序替换DummyRasberryPi。虚拟WPF应用程序将不是部署的.Net Core应用程序的一部分。
我有一个.Net Core控制台应用程序项目。这个在另一个WPF应用程序中被引用,
到Nuget。
但是在我想要显示WPF窗口的那一刻,应用程序崩溃。
错误消息:
System.IO.FileNotFoundException
HResult = 0x80070002
消息=无法加载文件或程序集'PresentationFramework,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'。系统找不到指定的文件。
来源= DummyRasberryPi
StackTrace:
在DummyRasberryPi.DummyRasberry.StartUIApplication()
内部异常1:
$
FileNotFoundException:无法加载指定的文件。
我想要运行app的方式:
private void StartUIApplication()
      {
var application = new System.Windows.Application();
application.Run(new DummyRasberryPiWindows());
$
}
我试图找到解决方案,但不知道是否有可能。
如果您需要更多信息,请询问:)
提前感谢
Lubos
Hi Lubomair,
关于在.Net中启动Wpf项目cor app,我知道我们可以 运行新的和现有的Windows桌面.NET Core 3上的应用程序,所以它是.net core 3 app?
这里有一些关于.NET核心3和窗口桌面应用程序支持的文章,你可以看看:
https://blogs.msdn.microsoft.com/dotnet/2018/08/08/are-your-windows-forms-and- wpf-applications-ready-for-net-core-3-0 /
最好的问候,
Cherry
Hello everybody
I got an issue that i am not able run WPF application from .NET Core app. I want to use simple WPF application as dummy RasberryPI, just to see if .NET core console application set I/O pins correctly. This dummy will be use only for make development faster. Later i will replace DummyRasberryPi with correct RasberryPi driver. Dummy WPF app will be not part of deployed .Net Core app.
I got one .Net Core console application project. This one is referenced in another WPF application, through Nuget.
But in moment where i want to show WPF window, app crash.
Error msg :
System.IO.FileNotFoundException
HResult=0x80070002
Message=Could not load file or assembly 'PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Source=DummyRasberryPi
StackTrace:
at DummyRasberryPi.DummyRasberry.StartUIApplication()
Inner Exception 1:
FileNotFoundException: Could not load the specified file.
The way I want to run app :
private void StartUIApplication()
{
var application = new System.Windows.Application();
application.Run(new DummyRasberryPiWindows());
}I tried to find solution, but dont know if it is possible.
If you need more info, just ask :)
Thanks for in advance
Lubos
解决方案Hi Lubomair,
About Starting Wpf project in .Net cor app, I know we can run new and existing Windows desktop applications on .NET Core 3, so it is .net core 3 app?
Here are some article about .NET core 3 and support for window desktop applications, you can take a look:
https://blogs.msdn.microsoft.com/dotnet/2018/08/08/are-your-windows-forms-and-wpf-applications-ready-for-net-core-3-0/
Best Regards,
Cherry
这篇关于从.NET核心应用程序启动WPF应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文登录 关闭
扫码关注1秒登录发送“验证码”获取 | 15天全站免登陆