如何将WPF .NET Core EXE添加为Visual Studio 2022的项目参考,以用作多重启动项目?
我有一个.net core
带有一个Console App
项目的解决方案。我想将另一个现有的WPF项目
添加到解决方案中,作为项目参考
,但没有其源代码。我想在wpfapp \ bin \ debug \ net6.0-windows
文件夹中仅包含存在于wpfapp \ bin \ bin \ bin \ debug \ debug \ debug> folder中的exe或依赖的dll。之后,我想将项目设置为
多重启动项目
,并希望我的WPF EXE在我的台应用程序应用程序构建并启动
时开始,并希望我的WPF EXE在控制台时关闭应用结束。
I have a .net core
solution with one console app
project. I want to add another existing WPF project
to solution as project reference
but without its source code. I want to include only exe or dependent dll that exists in WpfApp\bin\Debug\net6.0-windows
folder. After that I want to set my project as multiple startup project
and want my WPF exe to start when my console application build and start
and want my WPF exe to close when my console application ends.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据您的描述,我进行了一些与此问题有关的代码测试。
您可以参考以下代码来解决问题:
}
您需要更改代码中的文件路径和ProcessName。
这是我的测试结果:
According to your description, i make some code test related to this issue.
You can refer to the following code to solve the problem:
}
You need to change the file path and the ProcessName in the code.
Here is my test result:
简短的答案是你不能。 .exe不是C#项目。如果您确实想在不包含该解决方案的情况下运行WPF应用程序,请添加一些运行.EXE的代码。就像以下
调用上述启动方法一样
The short answer is you can't. An .exe is not a C# project. If you really want to run the WPF app without including it in the solution then add some code that runs the .exe. like the following
Calling the above method on startup would start the WPF .exe (only when the build mode is debug)