SlideShare a Scribd company logo
Automatic Deployment
Ivan Antsipau
Minsk .NET Meetup #2
Process
•
•
•
•
•
•
•

Build correct version of source code
Change configuration
Stop the application(s)
Deploy (copy files)
Backup DB(s)
Update DB(s)
Start the application(s)
Automatic Deployment on Microsoft .Net stack

2
Automatic Deployment
• “Web Deployment: If You're Using XCopy, You're Doing
It Wrong”
– SCOTT HANSELMAN (HTTP://GOO.GL/MHWJ77)

• Mooney’s Law Of Guaranteed Failure:
– In the software business, every manual process will suffer at
least a 10% failure rate, no matter how smart the person
executing the process. No amount of documentation or
formalization will truly fix this, the only resolution is
automation.
– (http://goo.gl/nuoVzM)
Automatic Deployment on Microsoft .Net stack

3
Manual Deployment Drawbacks
• A lot of time:
– Can’t run integration tests
– Cant’ execute often (no visibility for managers
and stake-holders)
– Can’t execute when business decides to

• Error-prone:

0.25h

CI executes
Daily Build

Automatic Deployment on Microsoft .Net stack

Cost to fix the issue

– Didn’t you deploy the Service? – Which
service?!
– Manual updates of the configuration.

4h

Issue Detection time
Manual QA

4
Components
• MSBuild (The Microsoft Build Engine)
– Build and package

• Web Deploy:
– Move to target server

• CI Server: Atlassian Bamboo, TFS, TeamCity, etc
– Trigger the process, report the results

Automatic Deployment on Microsoft .Net stack

5
Manage Configuration
• Differ by Environments (server name, etc)
• Differ by Build configuration (Debug vs Release)
• We want:
– Changes to be automated
– Differences to be versioned

Automatic Deployment on Microsoft .Net stack

6
Manage Configuration: transformations

Automatic Deployment on Microsoft .Net stack

7
Preview Transformation

Automatic Deployment on Microsoft .Net stack

8
Transformations (easy xslt)

• Locator (can be omitted):
– how to find

• Transform:
– what to do

“The Transform attribute specifies what you
want to do to the elements that
the Locator attribute finds.” MSDN
(http://goo.gl/7J4Mz9)

Automatic Deployment on Microsoft .Net stack

9
Locators
•

Match
–
–

•

Condition
–
–

•

Locator="Match(comma-delimited list of one or more attribute names)“
<add name="AWLT" connectionString="newstring" providerName="newprovider" xdt:Transform="Replace"
xdt:Locator="Match(name)" />
Locator="Condition(XPath expression)” (XPath appended to the current element's XPath expression)
<add name="AWLT" connectionString="newstring" providerName="newprovider" xdt:Transform="Replace"
xdt:Locator="Condition(@name='oldname'or @providerName='oldprovider')" />

Xpath
–
–

Locator="XPath(XPath expression)“(XPath IS NOT appended to the current element's XPath expression)
<add name="AWLT" connectionString="newstring" providerName="newprovider" xdt:Transform="Replace"
xdt:Locator="XPath(configuration/connectionStrings[@name='AWLT'
or @providerName='System.Data.SqlClient'])"
/>

Automatic Deployment on Microsoft .Net stack

10
Transforms
• Replace
<connectionStrings xdt:Transform="Replace">
<add name="SqlServer" connectionString=“str1;" />
<add name="Entities" connectionString=“str2;" />
</connectionStrings>

•
•
•
•
•
•

Insert
InsertBefore
InsertAfter
Remove
RemoveAll
RemoveAttriburtes
–

<compilation xdt:Transform="RemoveAttributes(debug)" />

• SetAttributes
More at MSDN (http://goo.gl/7J4Mz9)
Automatic Deployment on Microsoft .Net stack

11
Publish Profile
• Corresponds to target Environment (server)
– Where to publish
– How to publish
– How to transform

Automatic Deployment on Microsoft .Net stack

12
Publish Profile Settings

Automatic Deployment on Microsoft .Net stack

13
Profile is a Versioned XML File

Automatic Deployment on Microsoft .Net stack

14
Profile-Specific Config Transformations
• Connections strings
• External services addresses
• Other environment-specific settings

Automatic Deployment on Microsoft .Net stack

15
Profile-Specific Config Transformations

Automatic Deployment on Microsoft .Net stack

16
Chained Transformations
Original web.config
file

Configurationspecific

Publish profile –
specific

(Web.release.config)

(Web.staging.config)

Automatic Deployment on Microsoft .Net stack

17
Web Deploy (msdeploy)
• The right way to deploy to IIS.
• IIS extension:
– Install via MS Web Platform Installer

• Command-line tool:
– Comes with VS or installed separately

• Bad news: scary syntax
• Good news: VS team has prepared msbuild wrappers
Automatic Deployment on Microsoft .Net stack

18
Features
• Non-admin deployments (delegation)
• Deploy over https (secure)
• Powerful:
–
–
–
–
–
–
–
–

Copy files
Remove extra files
Skip rules
Take site offline/online
Run executable remotely
Install libs into GAC
Auto back up
Etc

In House

Azure

Web Platform Installer
(3-clicks)

Pre-installed:
(download publish profile)

• More at TechNet (http://goo.gl/1aM0uu) and IIS.net
(http://goo.gl/hnoMVR)
Automatic Deployment on Microsoft .Net stack

19
Command-line vs MSBuild wrappers

Msbuild.exe Web.csproj /p:DeployOnBuild=true /p:Configuration=Release
/p:PublishProfile=staging /p:VisualStudioVersion=11.0
/p:Password=p0ssw0rd

Automatic Deployment on Microsoft .Net stack

20
Web Deploy Settings in Publish Profile

Automatic Deployment on Microsoft .Net stack

21
Command-line run
Msbuild.exe Web.csproj /p:DeployOnBuild=true /p:Configuration=Release
/p:PublishProfile=staging /p:VisualStudioVersion=11.0
/p:Password=p0ssw0rd

Automatic Deployment on Microsoft .Net stack

22
Run From CI

Msbuild.exe Web.csproj /p:DeployOnBuild=true /p:Configuration=Release
/p:PublishProfile=staging /p:VisualStudioVersion=11.0 stack
Automatic Deployment on Microsoft .Net
/p:Password=p0ssw0rd

23
Update Database
• Migrations:
– Run on AppStart
– Run before/after deployment

• Database project:
– Run before/after deployment
– Has publish profiles

Automatic Deployment on Microsoft .Net stack

24
Database Project

Automatic Deployment on Microsoft .Net stack

25
Command-line publishing

Msbuild.exe /p:VisualStudioVersion=11.0 /t:Rebuild;Publish
/p:SqlPublishProfilePath=Database.staging.publish.xml Automatic Deployment on Microsoft .Net stack

26
Process
Build correct version of source code
Change configuration
• Stop the application(s)
Deploy (copy files), skip uploaded files
• Backup DB(s)
Update DB(s)
• Start the application(s)
Automatic Deployment on Microsoft .Net stack

27
Tips and Tricks: version
•
•

MSBuild Community Tasks (https://github.com/loresoft/msbuildtasks)
NuGet package available
Task

Description

Add

Add numbers

AddTnsName

Defines a database host within the Oracle TNSNAMES.ORA file.

AppPoolController

Allows control for an application pool on a local or remote machine with IIS installed. The default is to control the application
pool on the local machine. If connecting to a remote machine, you can specify the and for the task to run under.

Xslt

A task to merge and transform a set of xml files.

XslTransform

XslTransform task for Sandcastle.

AssemblyInfo

Generates an AssemblyInfo files

Attrib

Changes the attributes of files and/or directories on Microsoft .Net stack
Automatic Deployment

28
Usage

Automatic Deployment on Microsoft .Net stack

29
Output Version

Automatic Deployment on Microsoft .Net stack

30
Customize Web Deploy
• ProjectName.Wpp.targets – imported for any web
project before build
– Web.csproj -> Web.Wpp.targets

Automatic Deployment on Microsoft .Net stack

31
Ignore user-generated files

Automatic Deployment on Microsoft .Net stack

32
Set ACL Permissions
• Use .wpp.targets (see
http://sedodream.com/2011/11/08/settingfolderpermis
sionsonwebpublish.aspx ).

Automatic Deployment on Microsoft .Net stack

33
App_offline.htm
• Takes down the application
• Serve static app_offline.htm to notify users

Automatic Deployment on Microsoft .Net stack

34
App_offline.htm
•
•
•
•
•
•
•

Store as app_offline.template.htm
Rename to app_offline.htm before deployment
Update db, do other stuff
Skip on deployment (do not delete)
Rename to app_offline.template.htm when done
See details at http://goo.gl/qbGrKA
Alternatively: use AppOffline rule (http://goo.gl/tC0qxz)

Automatic Deployment on Microsoft .Net stack

35
Complex scenarios
• Using MSBuild to:
– Prepare
– Build
– Update Configuration
– Execute Deployment
– Etc

• Regex-based transformations for multiple similar
environments (QA1-QA10, Test1-Test10).
Automatic Deployment on Microsoft .Net stack

36
Thanks for Your Attention
ivan.antsipau@gmail.com
https://www.facebook.com/Ivan.Antsipau
Links
• App_offline
http://sedodream.com/2012/01/08/HowToTakeYourWebAppOffli
neDuringPublishing.aspx
• VS2010 Guide http://www.troyhunt.com/2010/11/youdeploying-it-wrong-teamcity.html
• VS2012 Deployment Guide
http://www.asp.net/mvc/tutorials/deployment/visual-studioweb-deployment/introduction
• http://stackoverflow.com/questions/tagged/webdeploy
• http://stackoverflow.com/questions/tagged/msdeploy
• http://blog.richardszalay.com/tag/msdeploy/
Automatic Deployment on Microsoft .Net stack

38
Links
• http://msbuildbook.com/ (examples on github)
• MSDN http://msdn.microsoft.com/enus/library/0k6kkbsd.aspx
• Sayed Ibrahim Hashimi http://sedodream.com/
, @SayedIHashimi
• http://www.msbuildexplorer.com/
• http://stackoverflow.com/questions/tagged/ms
build
• http://msdn.microsoft.com/enus/library/ms171483.aspx incremental build
Automatic Deployment on Microsoft .Net stack

39

More Related Content

PDF
MySQL in your laptop
PDF
Script it
PDF
Managing big test environment and running tests with Jenkins, Jenkins Job bui...
PPTX
Plone FSR
PPTX
PDF
JavaOne 2014: Taming the Cloud Database with jclouds
PDF
Choosing a Javascript Framework
PDF
Gradle - Build System
MySQL in your laptop
Script it
Managing big test environment and running tests with Jenkins, Jenkins Job bui...
Plone FSR
JavaOne 2014: Taming the Cloud Database with jclouds
Choosing a Javascript Framework
Gradle - Build System

What's hot (20)

PPTX
Spring boot Introduction
PDF
Play framework
PDF
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
PDF
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014
PPTX
Eddystone Beacons - Physical Web - Giving a URL to All Objects
PPT
An introduction to maven gradle and sbt
PDF
Run alone: a standalone application attempt by Gabriel Sor
PDF
手把手教你如何串接 Log 到各種網路服務
PPTX
Pantheon basics
PDF
Grails Plugin Best Practices
PDF
Building Grails Plugins - Tips And Tricks
PDF
REST APIs with Spring
KEY
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
DOCX
Deploying to azure web sites
PDF
20151010 my sq-landjavav2a
KEY
Using ActiveObjects in Atlassian Plugins
PDF
Arquillian Constellation
PDF
Serverless Java on Kubernetes
PDF
TibcoBW6.0
PDF
My "Perfect" Toolchain Setup for Grails Projects
Spring boot Introduction
Play framework
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014
Eddystone Beacons - Physical Web - Giving a URL to All Objects
An introduction to maven gradle and sbt
Run alone: a standalone application attempt by Gabriel Sor
手把手教你如何串接 Log 到各種網路服務
Pantheon basics
Grails Plugin Best Practices
Building Grails Plugins - Tips And Tricks
REST APIs with Spring
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
Deploying to azure web sites
20151010 my sq-landjavav2a
Using ActiveObjects in Atlassian Plugins
Arquillian Constellation
Serverless Java on Kubernetes
TibcoBW6.0
My "Perfect" Toolchain Setup for Grails Projects
Ad

Similar to Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14) (20)

PPTX
Harish Aspnet Deployment
PPTX
Web deploy
PPTX
Romulus crisan + radu pascal click'n'deploy
PPTX
Ordina SOFTC Presentation - Deployment with TFS Build and Workflow
PDF
Build automation best practices
PPTX
IIS Web Ecosystem
PPTX
Continuous Delivery with TFS msbuild msdeploy
PPTX
Accelerate Sitecore DevOps on Microsoft Azure
PPT
End To End Build Automation With Team Build
PPTX
Deploying configuring caching
DOCX
important DotNet Questions For Practicals And Interviews
PPTX
Automated release management - DevConFu 2014
PPTX
SQLUG MSBUILD SSRS Deployments
PPTX
Easing ASP.NET Web and SQL Server Database Deployment with VS 2010 and MsDeploy
PPTX
Click’n’Deploy | SuperSpeakers @CodeCamp Iasi, 2014
PPTX
Application Lifecycle Management with TFS
PPTX
Automated release management with team city & octopusdeploy - NDC 2013
PPTX
Azure DevOps työkalut - Roundtable 14.3.2019
PPTX
Azure DevOps for JavaScript Developers
PDF
Agile Change and Release Management at the #1 Online Rental Site in the US
Harish Aspnet Deployment
Web deploy
Romulus crisan + radu pascal click'n'deploy
Ordina SOFTC Presentation - Deployment with TFS Build and Workflow
Build automation best practices
IIS Web Ecosystem
Continuous Delivery with TFS msbuild msdeploy
Accelerate Sitecore DevOps on Microsoft Azure
End To End Build Automation With Team Build
Deploying configuring caching
important DotNet Questions For Practicals And Interviews
Automated release management - DevConFu 2014
SQLUG MSBUILD SSRS Deployments
Easing ASP.NET Web and SQL Server Database Deployment with VS 2010 and MsDeploy
Click’n’Deploy | SuperSpeakers @CodeCamp Iasi, 2014
Application Lifecycle Management with TFS
Automated release management with team city & octopusdeploy - NDC 2013
Azure DevOps työkalut - Roundtable 14.3.2019
Azure DevOps for JavaScript Developers
Agile Change and Release Management at the #1 Online Rental Site in the US
Ad

Recently uploaded (20)

PDF
Red Light Wali Muskurahat – A Heart-touching Hindi Story
PDF
Attachment Theory What Childhood Says About Your Relationships.pdf
PDF
Quiet Wins: Why the Silent Fish Survives.pdf
PPTX
PERDEV-LESSON-3 DEVELOPMENTMENTAL STAGES.pptx
PDF
SEX-GENDER-AND-SEXUALITY-LESSON-1-M (2).pdf
PPTX
cấu trúc sử dụng mẫu Cause - Effects.pptx
PDF
The Power of Pausing Before You React by Meenakshi Khakat
PPTX
Learn how to use Portable Grinders Safely
PDF
My 'novel' Account of Human Possibility pdf.pdf
PPTX
THEORIES-PSYCH-3.pptx theory of Abraham Maslow
PPTX
Chapter-7-The-Spiritual-Self-.pptx-First
PPTX
Emotional Intelligence- Importance and Applicability
PPTX
diasspresentationndkcnskndncelklkfndc.pptx
PPTX
Pradeep Kumar Roll no.30 Paper I.pptx....
PPTX
Commmunication in Todays world- Principles and Barriers
PPTX
Personal Development - By Knowing Oneself?
PDF
The Spotlight Effect No One Is Thinking About You as Much as You Think - by M...
PPTX
Attitudes presentation for psychology.pptx
PDF
⚡ Prepping for grid failure_ 6 Must-Haves to Survive Blackout!.pdf
PPTX
UNIVERSAL HUMAN VALUES for NEP student .pptx
Red Light Wali Muskurahat – A Heart-touching Hindi Story
Attachment Theory What Childhood Says About Your Relationships.pdf
Quiet Wins: Why the Silent Fish Survives.pdf
PERDEV-LESSON-3 DEVELOPMENTMENTAL STAGES.pptx
SEX-GENDER-AND-SEXUALITY-LESSON-1-M (2).pdf
cấu trúc sử dụng mẫu Cause - Effects.pptx
The Power of Pausing Before You React by Meenakshi Khakat
Learn how to use Portable Grinders Safely
My 'novel' Account of Human Possibility pdf.pdf
THEORIES-PSYCH-3.pptx theory of Abraham Maslow
Chapter-7-The-Spiritual-Self-.pptx-First
Emotional Intelligence- Importance and Applicability
diasspresentationndkcnskndncelklkfndc.pptx
Pradeep Kumar Roll no.30 Paper I.pptx....
Commmunication in Todays world- Principles and Barriers
Personal Development - By Knowing Oneself?
The Spotlight Effect No One Is Thinking About You as Much as You Think - by M...
Attitudes presentation for psychology.pptx
⚡ Prepping for grid failure_ 6 Must-Haves to Survive Blackout!.pdf
UNIVERSAL HUMAN VALUES for NEP student .pptx

Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14)

  • 2. Process • • • • • • • Build correct version of source code Change configuration Stop the application(s) Deploy (copy files) Backup DB(s) Update DB(s) Start the application(s) Automatic Deployment on Microsoft .Net stack 2
  • 3. Automatic Deployment • “Web Deployment: If You're Using XCopy, You're Doing It Wrong” – SCOTT HANSELMAN (HTTP://GOO.GL/MHWJ77) • Mooney’s Law Of Guaranteed Failure: – In the software business, every manual process will suffer at least a 10% failure rate, no matter how smart the person executing the process. No amount of documentation or formalization will truly fix this, the only resolution is automation. – (http://goo.gl/nuoVzM) Automatic Deployment on Microsoft .Net stack 3
  • 4. Manual Deployment Drawbacks • A lot of time: – Can’t run integration tests – Cant’ execute often (no visibility for managers and stake-holders) – Can’t execute when business decides to • Error-prone: 0.25h CI executes Daily Build Automatic Deployment on Microsoft .Net stack Cost to fix the issue – Didn’t you deploy the Service? – Which service?! – Manual updates of the configuration. 4h Issue Detection time Manual QA 4
  • 5. Components • MSBuild (The Microsoft Build Engine) – Build and package • Web Deploy: – Move to target server • CI Server: Atlassian Bamboo, TFS, TeamCity, etc – Trigger the process, report the results Automatic Deployment on Microsoft .Net stack 5
  • 6. Manage Configuration • Differ by Environments (server name, etc) • Differ by Build configuration (Debug vs Release) • We want: – Changes to be automated – Differences to be versioned Automatic Deployment on Microsoft .Net stack 6
  • 7. Manage Configuration: transformations Automatic Deployment on Microsoft .Net stack 7
  • 9. Transformations (easy xslt) • Locator (can be omitted): – how to find • Transform: – what to do “The Transform attribute specifies what you want to do to the elements that the Locator attribute finds.” MSDN (http://goo.gl/7J4Mz9) Automatic Deployment on Microsoft .Net stack 9
  • 10. Locators • Match – – • Condition – – • Locator="Match(comma-delimited list of one or more attribute names)“ <add name="AWLT" connectionString="newstring" providerName="newprovider" xdt:Transform="Replace" xdt:Locator="Match(name)" /> Locator="Condition(XPath expression)” (XPath appended to the current element's XPath expression) <add name="AWLT" connectionString="newstring" providerName="newprovider" xdt:Transform="Replace" xdt:Locator="Condition(@name='oldname'or @providerName='oldprovider')" /> Xpath – – Locator="XPath(XPath expression)“(XPath IS NOT appended to the current element's XPath expression) <add name="AWLT" connectionString="newstring" providerName="newprovider" xdt:Transform="Replace" xdt:Locator="XPath(configuration/connectionStrings[@name='AWLT' or @providerName='System.Data.SqlClient'])" /> Automatic Deployment on Microsoft .Net stack 10
  • 11. Transforms • Replace <connectionStrings xdt:Transform="Replace"> <add name="SqlServer" connectionString=“str1;" /> <add name="Entities" connectionString=“str2;" /> </connectionStrings> • • • • • • Insert InsertBefore InsertAfter Remove RemoveAll RemoveAttriburtes – <compilation xdt:Transform="RemoveAttributes(debug)" /> • SetAttributes More at MSDN (http://goo.gl/7J4Mz9) Automatic Deployment on Microsoft .Net stack 11
  • 12. Publish Profile • Corresponds to target Environment (server) – Where to publish – How to publish – How to transform Automatic Deployment on Microsoft .Net stack 12
  • 13. Publish Profile Settings Automatic Deployment on Microsoft .Net stack 13
  • 14. Profile is a Versioned XML File Automatic Deployment on Microsoft .Net stack 14
  • 15. Profile-Specific Config Transformations • Connections strings • External services addresses • Other environment-specific settings Automatic Deployment on Microsoft .Net stack 15
  • 16. Profile-Specific Config Transformations Automatic Deployment on Microsoft .Net stack 16
  • 17. Chained Transformations Original web.config file Configurationspecific Publish profile – specific (Web.release.config) (Web.staging.config) Automatic Deployment on Microsoft .Net stack 17
  • 18. Web Deploy (msdeploy) • The right way to deploy to IIS. • IIS extension: – Install via MS Web Platform Installer • Command-line tool: – Comes with VS or installed separately • Bad news: scary syntax • Good news: VS team has prepared msbuild wrappers Automatic Deployment on Microsoft .Net stack 18
  • 19. Features • Non-admin deployments (delegation) • Deploy over https (secure) • Powerful: – – – – – – – – Copy files Remove extra files Skip rules Take site offline/online Run executable remotely Install libs into GAC Auto back up Etc In House Azure Web Platform Installer (3-clicks) Pre-installed: (download publish profile) • More at TechNet (http://goo.gl/1aM0uu) and IIS.net (http://goo.gl/hnoMVR) Automatic Deployment on Microsoft .Net stack 19
  • 20. Command-line vs MSBuild wrappers Msbuild.exe Web.csproj /p:DeployOnBuild=true /p:Configuration=Release /p:PublishProfile=staging /p:VisualStudioVersion=11.0 /p:Password=p0ssw0rd Automatic Deployment on Microsoft .Net stack 20
  • 21. Web Deploy Settings in Publish Profile Automatic Deployment on Microsoft .Net stack 21
  • 22. Command-line run Msbuild.exe Web.csproj /p:DeployOnBuild=true /p:Configuration=Release /p:PublishProfile=staging /p:VisualStudioVersion=11.0 /p:Password=p0ssw0rd Automatic Deployment on Microsoft .Net stack 22
  • 23. Run From CI Msbuild.exe Web.csproj /p:DeployOnBuild=true /p:Configuration=Release /p:PublishProfile=staging /p:VisualStudioVersion=11.0 stack Automatic Deployment on Microsoft .Net /p:Password=p0ssw0rd 23
  • 24. Update Database • Migrations: – Run on AppStart – Run before/after deployment • Database project: – Run before/after deployment – Has publish profiles Automatic Deployment on Microsoft .Net stack 24
  • 25. Database Project Automatic Deployment on Microsoft .Net stack 25
  • 26. Command-line publishing Msbuild.exe /p:VisualStudioVersion=11.0 /t:Rebuild;Publish /p:SqlPublishProfilePath=Database.staging.publish.xml Automatic Deployment on Microsoft .Net stack 26
  • 27. Process Build correct version of source code Change configuration • Stop the application(s) Deploy (copy files), skip uploaded files • Backup DB(s) Update DB(s) • Start the application(s) Automatic Deployment on Microsoft .Net stack 27
  • 28. Tips and Tricks: version • • MSBuild Community Tasks (https://github.com/loresoft/msbuildtasks) NuGet package available Task Description Add Add numbers AddTnsName Defines a database host within the Oracle TNSNAMES.ORA file. AppPoolController Allows control for an application pool on a local or remote machine with IIS installed. The default is to control the application pool on the local machine. If connecting to a remote machine, you can specify the and for the task to run under. Xslt A task to merge and transform a set of xml files. XslTransform XslTransform task for Sandcastle. AssemblyInfo Generates an AssemblyInfo files Attrib Changes the attributes of files and/or directories on Microsoft .Net stack Automatic Deployment 28
  • 29. Usage Automatic Deployment on Microsoft .Net stack 29
  • 30. Output Version Automatic Deployment on Microsoft .Net stack 30
  • 31. Customize Web Deploy • ProjectName.Wpp.targets – imported for any web project before build – Web.csproj -> Web.Wpp.targets Automatic Deployment on Microsoft .Net stack 31
  • 32. Ignore user-generated files Automatic Deployment on Microsoft .Net stack 32
  • 33. Set ACL Permissions • Use .wpp.targets (see http://sedodream.com/2011/11/08/settingfolderpermis sionsonwebpublish.aspx ). Automatic Deployment on Microsoft .Net stack 33
  • 34. App_offline.htm • Takes down the application • Serve static app_offline.htm to notify users Automatic Deployment on Microsoft .Net stack 34
  • 35. App_offline.htm • • • • • • • Store as app_offline.template.htm Rename to app_offline.htm before deployment Update db, do other stuff Skip on deployment (do not delete) Rename to app_offline.template.htm when done See details at http://goo.gl/qbGrKA Alternatively: use AppOffline rule (http://goo.gl/tC0qxz) Automatic Deployment on Microsoft .Net stack 35
  • 36. Complex scenarios • Using MSBuild to: – Prepare – Build – Update Configuration – Execute Deployment – Etc • Regex-based transformations for multiple similar environments (QA1-QA10, Test1-Test10). Automatic Deployment on Microsoft .Net stack 36
  • 37. Thanks for Your Attention ivan.antsipau@gmail.com https://www.facebook.com/Ivan.Antsipau
  • 38. Links • App_offline http://sedodream.com/2012/01/08/HowToTakeYourWebAppOffli neDuringPublishing.aspx • VS2010 Guide http://www.troyhunt.com/2010/11/youdeploying-it-wrong-teamcity.html • VS2012 Deployment Guide http://www.asp.net/mvc/tutorials/deployment/visual-studioweb-deployment/introduction • http://stackoverflow.com/questions/tagged/webdeploy • http://stackoverflow.com/questions/tagged/msdeploy • http://blog.richardszalay.com/tag/msdeploy/ Automatic Deployment on Microsoft .Net stack 38
  • 39. Links • http://msbuildbook.com/ (examples on github) • MSDN http://msdn.microsoft.com/enus/library/0k6kkbsd.aspx • Sayed Ibrahim Hashimi http://sedodream.com/ , @SayedIHashimi • http://www.msbuildexplorer.com/ • http://stackoverflow.com/questions/tagged/ms build • http://msdn.microsoft.com/enus/library/ms171483.aspx incremental build Automatic Deployment on Microsoft .Net stack 39