创建 Web 部署包以设置 .net 版本并创建新网站
我开始使用 Web 部署来构建和部署 Web 应用程序。到目前为止,我可以构建一个包并部署它,但它并没有比 xcopy 部署做更多的事情。
所以我构建包的命令是这样的:
msbuild EMP.WebAdmin.csproj /T:Package /P:Configuration=Release;PackageLocation="D:\Packages\WebAdmin.zip";DeployIisAppPath="TestWebAdmin"
如果 TestWebAdmin 已经存在并且 .net 的版本已设置为 .net 4 一切似乎都很好。但是,我真正想做的是检查包以查看部署是否已存在,如果不存在则创建它(最好在定义的目录中)并确保所有主机标头设置正确。我对网络部署的要求是否太多了,我一直找不到一篇好的文章来讨论如何获得此类细节。
我想做的事情可能吗?
I'm starting to use web deploy to build and deploy a web application. So far I can build a package and deploy it, but it's not doing much more than a xcopy deployment would do.
so my command to build the package is this:
msbuild EMP.WebAdmin.csproj /T:Package /P:Configuration=Release;PackageLocation="D:\Packages\WebAdmin.zip";DeployIisAppPath="TestWebAdmin"
If the TestWebAdmin already exists and the version of .net has been set to .net 4 everything seem to be fine. However, what I'd really like to do is have the package check to see if the deployment already exists, if not create it (preferably in a defined directory) and to ensure that any host headers are set correctly. Am I asking too much of web deploy, I've not been able to find a good article which talks about how to go t this kind of detail.
Is what I'm trying to do possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
项目的“发布/打包网站”选项卡上的设置是什么?您的站点需要使用 IIS,并且您需要选中该框以包含 IIS 应用程序设置。另外,你是如何部署的?我的理解是,您使用的 msbuild 命令将构建包,但是您在哪里调用 msdeploy?
我没有 msdeploy 为我创建应用程序,但它正在运行我也包含的 Sql 更新脚本。
What are the settings on your Publish / Package Website tab for the project? Your site needs to be using IIS, and you need to check the box to include IIS application settings. Also, how are you deploying? My understanding is that the msbuild command you're using will build the package, but where are you calling msdeploy?
I don't have msdeploy creating the application for me, but it's running Sql update scripts I'm also including.
您可以直接调用 WebDeploy 来创建包并将其设置为构建后事件:
这样您就不必将应用程序部署到 IIS 服务器,事实上您不需要在盒子上安装 IIS。
You can call WebDeploy directly to create your package and set this as a post-build event:
This way you dont have to have your app deployed to an IIS server, in fact you dont event need IIS installed on the box.