简体   繁体   English

如何从Visual Studio C#中的不同解决方案启动另一个项目?

[英]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.

相关问题 从C#Visual Studio Project包含并启动PDF - Include and launch PDF from C# Visual Studio Project 将项目从OutSystems转换为C#Visual Studio解决方案 - Convert a project from OutSystems to C# Visual Studio solution C# 如何使用 Visual Studio 2019 以编程方式启动项目实例 - C# how to programmatically launch an instance of a project with Visual Studio 2019 如何启动visual studio + open solution + 启动项目 - How to launch visual studio + open solution + launch project 如何从C#项目的构建事件中访问Visual Studio解决方案级平台? - How can you access the Visual Studio solution level platform from a C# project's build event? Visual Studio Solution(.sln) / C#:以另一个项目的 dll 作为参数启动一个项目 - Visual Studio Solution(.sln) / C#: Start a project with another project's dll as parameter 如何从 Visual Studio (C#) 启动 PowerShell 脚本 - How to launch PowerShell script from Visual Studio (C#) Visual Studio 2005:从其他项目中调试C#代码吗? - Visual Studio 2005: Debug C# code from a different project? 如果我想使用外部库从C#项目调用Python代码,我应该如何设置Visual Studio解决方案? - How should I set up a Visual Studio solution if I want to make a call from a C# project into Python code, with external libraries? 如何在 Visual Studio 中调用另一个 C# 库项目的方法? - How to call a method from another C# library project in Visual Studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM