Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
“如何实现自动化”;运行asp.net网站“;从命令行?_Asp.net_Visual Studio_Batch File_Iis_Iis Express - Fatal编程技术网

“如何实现自动化”;运行asp.net网站“;从命令行?

“如何实现自动化”;运行asp.net网站“;从命令行?,asp.net,visual-studio,batch-file,iis,iis-express,Asp.net,Visual Studio,Batch File,Iis,Iis Express,现在,我执行以下手动步骤在电脑上运行ASP.NET网站: 打开Visual Studio及其内部的项目 按Ctrl+F5键,其中: 构建解决方案 运行IIS express 打开浏览器 如何编写执行相同操作的批处理文件?最后一步(打开浏览器)是可选的,但至少我需要生成项目并在IIS express(或项目文件中配置的任何内容)上启动它。从visual studio命令行可以执行以下操作: devenv "C:\path\FooSolution.sln" /run 将这一切打包成一个批处理文

现在,我执行以下手动步骤在电脑上运行ASP.NET网站:

  • 打开Visual Studio及其内部的项目
  • 按Ctrl+F5键,其中:
  • 构建解决方案
  • 运行IIS express
  • 打开浏览器

  • 如何编写执行相同操作的批处理文件?最后一步(打开浏览器)是可选的,但至少我需要生成项目并在IIS express(或项目文件中配置的任何内容)上启动它。

    从visual studio命令行可以执行以下操作:

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

    将这一切打包成一个批处理文件(假设VS 2012),它将变成:

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

    要使用IIS Express在Visual Studio外部运行此操作,请使用以下命令:

    msbuild.exe "C:\path\FooSolution.sln" 
    iisexpress /path:c:\path\fooapp\ /port:666
    start "" http://localhost:666
    
    请注意,msbuild和iisexpress命令都有许多配置选项。您需要根据自己的需要对其进行调整


    有没有一种方法可以在不启动Visual Studio的情况下执行此操作?我想生成可以由MSBuild完成,因此,如果有一种方法可以以静默方式启动IIS Express并获得结果,那就太好了。@hutchonoid有没有一种方法可以从命令行向我的解决方案中添加项目?提前感谢:)