-->

运行从Visual Studio控制台的解决方案,而无需打开IDE(Run a solution f

2019-08-18 21:24发布

我使用的Visual Studio 2010 SP1。

我第一次尝试是这样的:

  1. 从打开开始菜单中的Visual Studio控制台工具
  2. 导航到项目文件夹(已经包含可执行文件)
  3. 运行: msbuild myproject.sln or msbuild myproject.sln /p:Configuration=Release
  4. 这成功地建立,但我不能找到一个可执行文件运行

 

  1. 我尝试的第二件事是步骤1和2从上方
  2. 运行: devenv myproject.sln /Build and devenv myproject.sln /Run
  3. 这一定程度上工作,但它似乎打开IDE运行构建
  4. 整点是避免使用IDE的。

现在,我该如何构建和运行,而无需打开IDE的解决方案?

- - - - - - - - - - - - - 固定 - - - - - - - - - - - - -------

问题是,我是找错了地方的可执行文件(小白错误)。 我结束了使用此批处理文件:

msbuild myproj.sln /p:configuration=Release
cd (("Path to executable" usually in the Debug/Release Folder))
myExecutableName
cd (("Path to original folder"))

Answer 1:

  • 浏览到您的解决方案文件夹
  • 运行:的msbuild myproject.sln / P:配置=推出(或调试)
  • CD的myproject(您的解决方案文件夹中 - 这是一个子文件夹)
  • CD箱
  • CD的发行(或Debug)
  • 运行:myproject.exe

您可以更换三个独立的cd用单一一个命令:

cd myproject\bin\Release

或者干脆请从解决方案文件夹的可执行文件:

myproject\bin\Release\myproject.exe


文章来源: Run a solution from Visual Studio console without opening the IDE