创建 Web 部署包以设置 .net 版本并创建新网站

发布于 2024-09-29 08:27:24 字数 440 浏览 0 评论 0原文

我开始使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柒七 2024-10-06 08:27:24

项目的“发布/打包网站”选项卡上的设置是什么?您的站点需要使用 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.

悍妇囚夫 2024-10-06 08:27:24

您可以直接调用 WebDeploy 来创建包并将其设置为构建后事件:

"%ProgramFiles%\IIS\Microsoft Web Deploy\msdeploy.exe" -source:iisApp="<physical path to your app>" -dest:package=d:\myApp.zip

这样您就不必将应用程序部署到 IIS 服务器,事实上您不需要在盒子上安装 IIS。

You can call WebDeploy directly to create your package and set this as a post-build event:

"%ProgramFiles%\IIS\Microsoft Web Deploy\msdeploy.exe" -source:iisApp="<physical path to your app>" -dest:package=d:\myApp.zip

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文