sukesh
sukesh

Reputation: 2523

Web Deploy - How to create a package with selected items

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. It is an enterprise site & is hosted on multiple servers (with continuous deployment).

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

  3. 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

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

  4. The project 'mysite' is an 'ASP.NET Website' and not 'ASP.NET Web Application' (in VS2013), which means these options are unavailable - Package/Publish Web & Package/Publish SQL

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. Is it possible to create a package only for the files I need (in this case accounts.cs, accounts.aspx, accounts.aspx.cs), using VS publish feature.
  2. Is it possible to include custom SQL scripts file in the package. (using IIS or VS)
  3. If the answer is a Yes for Q2, then it should be executed only once, not for all servers. Because there is only one DB server. How can it be done.

I did not go for the Installing package part yet.

Upvotes: 0

Views: 2088

Answers (1)

chief7
chief7

Reputation: 14373

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.

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 - 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.

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

Upvotes: 3

Related Questions