Web 部署 - 如何创建包含所选项目的包 [英] Web Deploy - How to create a package with selected items

本文介绍了Web 部署 - 如何创建包含所选项目的包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想尝试使用Web 部署"方法来部署我们的网站.在提出问题之前,我想提供一些有关当前部署过程的详细信息:

I would like to try the 'Web Deploy' method to deploy our website. Before my questions, I would like to provide a few details about the current deployment procedure:

  1. 这是一个企业网站&托管在多台服务器上(持续部署).

  1. It is an enterprise site & is hosted on multiple servers (with continuous deployment).

文件不是处于发布"模式,而是处于调试"模式.

The files are not in 'Release' mode, but in 'Debug' mode.

我们仅手动复制粘贴当前作业相关的文件.说,这周要部署Accounts模块,那么要部署的文件是
/mysite/App_Code/Models/accounts.cs
/mysite/pages/accounts.aspxaccounts.aspx.cs

We manually copy paste only the current assignment related files. Say, this week, the Accounts module is to be deployed, then the files to be deployed are
/mysite/App_Code/Models/accounts.cs
/mysite/pages/accounts.aspx, accounts.aspx.cs

这 3 个文件将被手动复制到所有服务器中的相应文件夹.多年来,这一直是这里的程序.

The 3 files will be copied to the respective folders in all the servers manually. This has been the procedure for years here.

我已经在开发系统中创建了包,
(i) 使用 Visual Studio 中的发布选项(Web 部署包)以及
(ii) 在 IIS 中导出应用程序(提供选择文件的选项)

I have created the packages in the dev system,
(i) using the publish option(web deployment package) in Visual Studio and also
(ii) export application in IIS (gives the option to select the files)

  1. 是否可以使用 VS 发布功能仅为我需要的文件(在本例中为 account.cs、accounts.aspx、accounts.aspx.cs)创建包.
  2. 是否可以在包中包含自定义 SQL 脚本文件.(使用 IIS 或 VS)
  3. 如果 Q2 的答案是肯定的,那么它应该只执行一次,而不是对所有服务器执行.因为只有一台数据库服务器.怎么办.

我还没有去安装包部分.

I did not go for the Installing package part yet.

推荐答案

1 - 不是通过 VS,因为 MSBuild for Websites 中没有(我知道的)扩展点.Sayed 有一篇很棒的博文,其中描述了如何区别对待网站和应用程序.

1 - Not through VS because there is no extension point (that I know of) into MSBuild for Websites. Sayed has a great post which describes how Websites are treated differently than Apps.

替代方案 - 您可以将要部署的文件复制到新文件夹,然后使用 MSDeploy.exe 命令行工具创建客户 MSDeploy 包,您可以将其部署到您的服务器.

Alternative - You could copy the files you wish to deploy to a new folder and then use the MSDeploy.exe commandline tool to create a customer MSDeploy package which you can deploy to your server.

D:\temp>"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:contentPath=%cd%\DefaultWebSite\website1 -dest:package=DefaultWebSite.zip
Info: Updating MSDeploy.contentPath (MSDeploy.contentPath).
Info: Adding virtual path (D:\temp\DefaultWebSite\website1)
Info: Adding directory (D:\temp\DefaultWebSite\website1).
Total changes: 3 (2 added, 0 deleted, 1 updated, 0 parameters changed, 0 bytes c
opied)

D:\temp>"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package=DefaultWebSite.zip -dest:contentPath="Default Web Site\website2"
Info: Adding MSDeploy.contentPath (MSDeploy.contentPath).
Info: Adding virtual path (Default Web Site\website2)
Info: Adding directory (Default Web Site\website2).
Info: Adding file (Default Web Site\website2\Default.aspx).
Info: Adding file (Default Web Site\website2\Default.aspx.cs).
Info: Adding file (Default Web Site\website2\Web.config).
Total changes: 6 (6 added, 0 deleted, 0 updated, 0 parameters changed, 971 bytes
 copied)

2/3 - 是的,您可以将 SQL 包含到 Web 部署包中,但每次部署包时都会部署它.我们发现最好将我们的 SQL 部署分离到自己的包中,这样我们就可以仅在需要时进行部署.

2/3 - Yes you could include SQL into the web deployment package but it would be deploy each time the package is deployed. We have found its better to seperate our SQL deployments into its own package so we can deploy it only when we want to.

这篇文章描述了我们如何处理 SQL 部署 - https://dotnetcatch.com/2016/02/10/deploying-a-database-project-with-msdeploy/

This post describes how we handle our SQL deployments - https://dotnetcatch.com/2016/02/10/deploying-a-database-project-with-msdeploy/

这篇关于Web 部署 - 如何创建包含所选项目的包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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