Run a solution from Visual Studio console without opening the IDE

可紊 提交于 2019-12-18 10:56:33

问题


I am using Visual Studio 2010 SP1.

What I first tried was this:

  1. Open the Visual Studio console tool from start menu
  2. Navigate to project folder (which already contains an executable)
  3. Run: msbuild myproject.sln or msbuild myproject.sln /p:Configuration=Release
  4. This builds successfully, but I can't find an executable to run

 

  1. The second thing I tried was steps 1 and 2 from above
  2. Running: devenv myproject.sln /Build and devenv myproject.sln /Run
  3. This somewhat works but it seems to open the IDE to run the build
  4. The whole point was to avoid using the ide at all.

Now, how do I build and run a solution without opening the IDE?

--------------------------FIXED------------------------------

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"))

回答1:


  • 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

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


来源:https://stackoverflow.com/questions/15754302/run-a-solution-from-visual-studio-console-without-opening-the-ide

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!