在一个解决方案中构建和运行两个项目 [英] Building and running two projects in one solution

查看:29
本文介绍了在一个解决方案中构建和运行两个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Visual Studio 2019 对放置在主解决方案中的两个独立项目进行编码.第一部分只是将在客户端机器中编译的客户端代码(不是在 Visual Studio 中,它只是在构建后将复制到其他文件夹的原始代码).第二部分是当我按下 Debug 按钮时必须编译的服务器端代码.

I'm using Visual Studio 2019 to code my two separate projects placed in main solution. First part is just a Client-side code that will be compilated in a client's machine (Not in Visual Studio, it's only raw code that will be copied to other folder after Build). And second part is a server-side code that have to be complited when I press Debug button.

我想要以下内容:当我按 F5(运行我的代码)时,第一个项目应该像我选择的那样构建,然后按 ctrl+b,此时应该调试第二个项目(编译和打开).

I want the following: when I press F5 (To run my code), first project should be built like as I choose it and press ctrl+b and in this time second project should be debugged (compiled and opened).

客户端项目(第一个项目)只是我需要复制到不同文件夹的几个文件,无需任何编译和 VS 的东西,这是构建后事件命令行:

Client-side project (first project) is just a couple of files that I need to copy to different folder without any compilation and VS's stuff, here's post-build event command line:

del "path_to_work*.*" /Q
for /R %CD% %%i in (*.cs) do (xcopy %%i "path_to_work" /Q /Y /EXCLUDE:exclude.txt)

为了清除情况,我厌倦了在项目之间切换,需要一键完成两个操作(构建和调试).

To clear situation, I'm bored with switching among projects and need to do two actions in one click (Build & Debug).

我为我糟糕的英语道歉.

I apologize for my terrible English.

推荐答案

Visual Studio 支持同时构建和运行多个项目,但它需要一个序列.

Visual Studio support builds and runs multiple projects at the same time, but it requires a sequence.

简而言之,您可以随时使用右键单击项目>调试>启动新实例随时运行任何项目.

In short, you can always use right-click project> Debug> Start new instance to run any project at any time.

例如:右键单击运行后端项目然后再次右键单击运行客户端项目,两个实例同时运行.

Eg: right click run backend project then right click again run client project, both instances run simultaneously.

如果这个解决方案不是那么自动化的解决方案,请道歉,但它很简单,工作起来很有魅力.

Apologize if this solution not so automated solution, but it simple and work like charm.

这篇关于在一个解决方案中构建和运行两个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆