Visual Studio 2010 - 如何在构建期间发布到本地 IIS [英] Visual Studio 2010 - How to publish to local IIS during build

查看:33
本文介绍了Visual Studio 2010 - 如何在构建期间发布到本地 IIS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 VS 2010 中开发 ASP.Net MVC Web 应用程序.我想在我自己的 Web 下在本地 IIS 7 中运行 Web 应用程序.我设置了我的主机文件,以便 *.dev 指向我的本地 IP,所以当我创建一个 IIS Web 时,我可以给它一个唯一的主机名,比如 myapp.dev 并且它运行.

I am working on an ASP.Net MVC web app in VS 2010. I want to run the web app in my local IIS 7 under it's own web. I have my hosts file set up so that *.dev points back to my local ip so when I create an IIS web i can just give it a unique host name like myapp.dev and it runs.

这是我使用 VS 的第一个 Web 应用程序项目,我正在尝试弄清楚如何在我点击构建时让 VS 将 Web 应用程序代码发布到我的本地网络.我已经有发布部分工作,但我想自动化它.此外,我可能还要补充一点,我有几个不同的层(类库),它们也需要同时构建和发布.

This is my first web application project with VS and I am trying to figure out how to make VS publish the web app code to my local web when I hit build. I already have the publish part working but i want to automate it. Also I might add that I have a couple different layers (class libraries) that need to also build and publish all at once.

总而言之,我想要发生的是在更改代码后我想单击重建解决方案或重建项目,成功构建后我希望将更改的文件发布到我为此特定网络应用程序设置的网络根目录在我本地的 IIS 中.然后我可以刷新浏览器来测试我的更改.

In summary what I want to happen is after making code changes I want to click rebuild solution or rebuild project and after successful build I want the files that changed to be published to the web root I have set up for this particular web app in my local IIS. Then I can just refresh the browser to test my changes.

有人可以推荐我参考此类设置的任何教程吗?

Are there any tutorials on this type of set up someone can refer me to?

推荐答案

您是否在开发过程中尝试使用 IIS 而不是 ASP.NET 开发 Web 服务器?如果是,您可以转到 Web 项目的设置,然后转到 Web 选项卡,将开发 Web 服务器更改为 IIS 并指定一个 url.这样你就不需要发布任何东西,虚拟目录指向你的项目文件夹.因此,当您编译并运行 Web 应用程序时,它会发现任何更改.如果这不是您想要的,您可以在构建后步骤中使用 msdeploy 命令行工具将您的 Web 应用程序打包和部署/更新到本地 IIS.这样每次构建时,msdeploy 都会运行并使用更改更新 IIS.

Are you trying to use IIS instead of the ASP.NET development web server during development? If it is you can go to your web project's settings and then to the web tab to change the development web server to IIS and specify a url. This way you don't need to publish anything, the virtual directory points to your project's folder. So when you compile and run your web application, it will pick up any change. If this is not what you want, you can use msdeploy command line tool in the post-build step to package and deploy/update your web application to local IIS. This way each time you build, msdeploy will run and update IIS with the changes.

这篇关于Visual Studio 2010 - 如何在构建期间发布到本地 IIS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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