本文介绍了从Visual Studio控制台运行解决方案,而不打开IDE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 SP1。
我第一次尝试的是这样:
What I first tried was this:
- 从开始菜单打开Visual Studio控制台工具
- 导航到项目文件夹(已包含可执行文件)
- 运行:
msbuild myproject.sln或msbuild myproject.sln / p:Configuration =发布
- 已成功建立,但找不到可执行档。
- Open the Visual Studio console tool from start menu
- Navigate to project folder (which already contains an executable)
- Run:
msbuild myproject.sln or msbuild myproject.sln /p:Configuration=Release
- This builds successfully, but I can't find an executable to run
- 我尝试的第二件事是从上面的步骤1和2
- 运行:
devenv myproject.sln / Build and devenv myproject.sln / Run
- 这有些工作, IDE运行构建
- 整个问题是避免使用ide。
- The second thing I tried was steps 1 and 2 from above
- Running:
devenv myproject.sln /Build and devenv myproject.sln /Run
- This somewhat works but it seems to open the IDE to run the build
- The whole point was to avoid using the ide at all.
现在,如何在不打开IDE的情况下构建和运行解决方案?
Now, how do I build and run a solution without opening the IDE?
--------------- ----------- FIXED ------------------------------
问题是,我正在寻找错误的地方的可执行文件(noob错误)。我最后使用这个批处理文件:
The problem was that I was looking in the wrong place for the executable (noob mistake). I ended up using this batch file:
msbuild myproj.sln /p:configuration=Release
cd (("Path to executable" usually in the Debug/Release Folder))
myExecutableName
cd (("Path to original folder"))
推荐答案
- 导航到您的解决方案文件夹
- 运行:msbuild myproject。 sln / p:Configuration = Release(或Debug)
- cd myproject(在您的解决方案文件夹中 - 它是一个子文件夹)
- / li>
- cd发布(或调试)
- 运行:myproject.exe
- Navigate to your solution folder
- Run: msbuild myproject.sln /p:Configuration=Release (or Debug)
- cd myproject (within your solution folder - it's a sub-folder)
- cd bin
- cd Release (or Debug)
- Run: myproject.exe
您可以用一个单独的命令替换三个单独的 cd
命令:
You can replace the three separate cd
commands with a single one:
cd myproject\bin\Release
或者只需从解决方案运行您的可执行文件资料夹:
Or simply run your executable from the solution folder:
myproject\bin\Release\myproject.exe
这篇关于从Visual Studio控制台运行解决方案,而不打开IDE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!