[英]How to launch another project from a different solution in Visual Studio C#?
I have two VS solutions A and B and I want to launch A1 project from solution A from the project B1 from solution B. 我有两个VS解决方案A和B,我想从解决方案B的项目B1启动解决方案A的A1项目。
Just so you know solution A has more than one project that can be launched. 众所周知,解决方案A有多个可以启动的项目。 I tried to added A1 as a reference in project B1 but it didn't work so well and I'm getting some error.
我试图在项目B1中将A1添加为参考,但效果不是很好,并且出现了一些错误。
Does anyone know what is the correct way to do this? 有谁知道这样做的正确方法是什么? Thanks in advance!
提前致谢!
Right click on your Solution A in solution explorer, go to Add and then click existing project. 在解决方案资源管理器中右键单击解决方案A,转到“添加”,然后单击现有项目。 Locate the .csproj file for the project from Solution B. That project will then appear in Solution A. You can then set multiple start up projects to get it to run along side the Solution A project.
在解决方案B中找到该项目的.csproj文件。该项目将出现在解决方案A中。然后,您可以设置多个启动项目,使其与解决方案A项目一起运行。
As a side note, using this method will cause the project from Solution B to build rather than just executing the last exe from the bin folder. 附带说明,使用此方法将导致解决方案B中的项目生成,而不仅仅是执行bin文件夹中的最后一个exe。
Hope it helps! 希望能帮助到你!
I tried different ways mentioned in the forum and found the solutions: - Add project A1 (.exe) as a reference to project B1. 我尝试了论坛中提到的其他方法,并找到了解决方案:-添加项目A1(.exe)作为对项目B1的引用。 - Make sure both projects use the same platform target (x86, x64 or any) since I got an error message because they were using different.
-确保两个项目都使用相同的平台目标(x86,x64或任何平台),因为我收到一条错误消息,因为它们使用的平台不同。 - Then call project A1 with constructor from B1.
-然后使用B1中的构造函数调用项目A1。
It might seems confusing but I got it work without using Process because someone told me it would be more complicated to use Process. 似乎令人困惑,但是我不用使用Process就可以工作,因为有人告诉我使用Process会更加复杂。
Thanks for all your replies! 感谢您的回复!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.