How to automate “run asp.net website” from command line?

前端 未结 1 948
北海茫月
北海茫月 2020-12-31 19:58

Right now, I do the following manual steps to run an ASP.NET website on my PC:

  1. Open Visual Studio and the project inside it
  2. Press Ctrl+F5 which:
相关标签:
1条回答
  • 2020-12-31 20:31

    From the visual studio command line you could do the following:

    devenv "C:\path\FooSolution.sln" /run
    

    MSDN Devenv Command Line Switches Reference

    Wrapping this all up into a batch file (assuming VS 2012) it would become:

    call "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat" 
    devenv "C:\path\FooSolution.sln" /Run
    

    Update

    To run this outside of Visual Studio with IIS Express you would use the following commands:

    msbuild.exe "C:\path\FooSolution.sln" 
    iisexpress /path:c:\path\fooapp\ /port:666
    start "" http://localhost:666
    

    Please note there are many configuration options for both msbuild and iisexpress command. You will need to tailor them to suite your needs.

    Running IIS Express from the Command Line

    0 讨论(0)
提交回复
热议问题