如何自动化“运行asp.net网站”从命令行? [英] How to automate "run asp.net website" from command line?

查看:432
本文介绍了如何自动化“运行asp.net网站”从命令行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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


  1. 打开Visual Studio和项目里面的项目

  2. 按Ctrl + F5:
  1. Open Visual Studio and the project inside it
  2. Press Ctrl+F5 which:

  1. 构建解决方案

  2. 运行IIS快递

  3. 打开浏览器


如何编写一个同样的东西的批处理文件?最后一步(打开浏览器)是可选的,但至少我需要构建项目并在IIS express上启动它(或者在项目文件中配置的任何内容)。

How to write a batch file that does the same thing? The last step (opening a browser) is optional but at least I need to build the project and start it on IIS express (or whatever is configured in the project file).

推荐答案

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

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

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

MSDN Devenv命令行参考开关参考

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

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

更新

在Visual Studio外部运行IIS Express您将使用以下命令:

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

请注意,msbuild有很多配置选项和iisexpress命令。您需要根据自己的需要定制它们。

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

从命令行运行IIS Express

Running IIS Express from the Command Line

这篇关于如何自动化“运行asp.net网站”从命令行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆