SharePoint Saturday Austin: Automatic Build and Deploy using Team Foundation Server
-
Upload
travis-lingenfelder -
Category
Documents
-
view
1.007 -
download
0
description
Transcript of SharePoint Saturday Austin: Automatic Build and Deploy using Team Foundation Server
Travis LingenfelderSenior Lead Consultant, Catapult Systems
Automatic Build and Deploy using Team Foundation Server
2 | SharePoint Saturday Austin 2013
• Please turn off all electronic devices or set them to vibrate
• If you must take a phone call, please do so in the hall
• Wi-Fi is available, you will need your Guest ID/password(at registration desk)
• Feel free to tweet and blog during sessions. Remember to follow @SPSATX and tag #SPSATX in your tweets!
THANK YOU FOR BEING A PART OF SHAREPOINT SATURDAY AUSTIN!
SharePoint Saturday Austin is hosted bythe Austin SharePoint User Group
(@AustinSPUG)
3 | SharePoint Saturday Austin 2013
• Build Controller – A Windows service that creates the name of the build, version control label, logging, and monitors status of the build. Manages a pool of build agents.
• Build Agent – Performs the processor-intensive work (compiling code, running tests, provisioning the workspace) for a build.
• Drop Folder – The location where compiled project output is saved.
• Build Definition – Instructions for what to compile and how to process
• Build Process Template – The workflow process for managing the workspace and actions performed during the build process.
DEFINITIONS
SETUP OF THE BUILD SYSTEM
5 | SharePoint Saturday Austin 2013
• A build controller is associated with a team project collection
• A team project collection can have multiple build controllers
• A build controller uses 1 or more build agents
BUILD CONTROLLERS & AGENTS
6 | SharePoint Saturday Austin 2013
Can all be on a single server
BUILD SYSTEM FOR SHAREPOINT
TeamFoundationServer
Application Tier
Build Server
Build Controller
Build Agent
SharePoint
TargetServer SharePoint
TriggersBuild
PowerShellDeployment
TriggersBuild
FileServer Drop Folder
Save Build Output
7 | SharePoint Saturday Austin 2013
• TFS Team Build Service• .NET Framework 4• Windows SDK• Domain-Specific Language (DSL)• SharePoint Assemblies• Visual Studio or Tool Assemblies• MS script - http://go.microsoft.com/fwlink/?
LinkId=188064- OR –• TFS Team Build Service• Visual Studio• SharePoint
SHAREPOINT BUILD SERVER REQUIREMENTS
8 | SharePoint Saturday Austin 2013
CONFIGURE A SHAREPOINT BUILD CONTROLLER
9 | SharePoint Saturday Austin 2013
CONFIGURE A SHAREPOINT BUILD AGENT
10 | SharePoint Saturday Austin 2013
• Make sure the service account for the build agent is granted the following rights on the build server:
• Local Administrator• SharePoint Farm Administrators• Add-SPShellAdmin• Full Control Web Application Policy
CONFIGURE A SHAREPOINT BUILD AGENT
CREATE A BUILD DEFINITION
12 | SharePoint Saturday Austin 2013
CREATE A BUILD DEFINITION
13 | SharePoint Saturday Austin 2013
CREATE A BUILD DEFINITION
14 | SharePoint Saturday Austin 2013
CREATE A BUILD DEFINITION
15 | SharePoint Saturday Austin 2013
CREATE A BUILD DEFINITION
16 | SharePoint Saturday Austin 2013
CREATE A BUILD DEFINITION
17 | SharePoint Saturday Austin 2013
CREATE A BUILD DEFINITION
18 | SharePoint Saturday Austin 2013
BUILD THE WSP
19 | SharePoint Saturday Austin 2013
CREATE A BUILD DEFINITION
WORKING WITH A BUILD PROCESS TEMPLATE AND
CUSTOM WORKFLOW ACTIONS
21 | SharePoint Saturday Austin 2013
• Add project references to the following assemblies:– Microsoft.TeamFoundation.Build.Client– Microsoft.TeamFoundation.Build.Workflow
CREATING WORKFLOW ACTIVITIES
22 | SharePoint Saturday Austin 2013
• Assembly Version – used as part of the assembly identifier (strong name) – Do not change between builds
• File Version – informational version not used by the runtime – Use this for build information
ABOUT ASSEMBLY VERSIONS
<%@ Register Tagprefix="SharePointWebControls" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
23 | SharePoint Saturday Austin 2013
Logic for all actions (tasks) that will be taken during the build• Windows Workflow Foundation• Found in the BuildProcessTemplates
folder of a team project• Edit using the workflow designer• Add custom workflow actions
Tip: be sure to register the version control path for custom assemblies
• Make copies of default templates before editing
EDITING A BUILD PROCESS TEMPLATE
24 | SharePoint Saturday Austin 2013
BUILD PROCESS PARAMETERS (ARGUMENTS)
25 | SharePoint Saturday Austin 2013
• Create a Visual Studio .NET Framework 4 class library project to edit the workflow when using custom build workflow activities.
• Add the XAML process template to the project.
• Add project references to custom activities project(s)• Add a reference to the following assemblies:
– C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0• Microsoft.TeamFoundation.Build.Client.dll
– C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0• Microsoft.TeamFoundation.Build.Client.dll• Microsoft.TeamFoundation.VersionControl.Client.dll• Microsoft.TeamFoundation.WorkItemTracking.Client.dll
– C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies• Microsoft.TeamFoundation.Build.Workflow.dll• Microsoft.TeamFoundation.TestImpact.BuildIntegration.dll
– C:\Windows\assembly\GAC_MSIL\Microsoft.TeamFoundation.TestImpact.Client\10.0.0.0__b03f5f7f11d50a3a• Microsoft.TeamFoundation.TestImpact.Client.dll
– System.Activities– System.Drawing– System.ServiceModel– System.ServiceModel.Activities– System.Xaml
BUILD PROCESS TEMPLATE PROJECT
DEMO
27 | SharePoint Saturday Austin 2013
• SharePoint PowerShell add-in is 64-bit only• Visual Studio is a 32-bit application• TFS Build Service can be 32-bit or 64-bit
• %SystemRoot%\System32 64-bit• %SystemRoot%\SysWOW64 32-bit (virtualized as
System32)
How do I launch a 64-bit version of PowerShell from a 32-bit Process?
• %SystemRoot%\sysnative• %SystemRoot%\sysnative\WindowsPowerShell\v1.0\
powershell.exe
64-BIT POWERSHELL
APPLICATION LIFECYCLE CODE BRANCHES AND
DEPLOYMENT
29 | SharePoint Saturday Austin 2013
CODE DEPLOYMENT PATH
At different times in the application development lifecycle we will want to deploy to different environments.
Production
User Acceptance Testing
Quality Assurance
Local Development
30 | SharePoint Saturday Austin 2013
SCHEDULED CURRENT RELEASE ITEMSMain Development Branch• vNext Release Items
QA Environment
Daily or Weekly Builds
31 | SharePoint Saturday Austin 2013
CODE COMPLETE: TIME TO BRANCHMain Development Branch• vNext Release Items
Next Release Branch
• Bug fixes
Code Complete
QA Environment
Daily or Weekly Builds
UAT/Pre-Production
CreateBranch
Production Support Branch
• Hotfixes
Pre-Production & Production Environments
Deployed to Production
Branch Becomes
32 | SharePoint Saturday Austin 2013
CODE BRANCHES AND DEPLOYMENT
Main Development Branch• 1.2
Next Release Branch
• 1.1
Production Support Branch
• 1.0
Before Deployment
Main Development Branch• 1.2
Production Support Branch
• 1.1
Archived Branch
• 1.0
After DeploymentDeploy to Production
33 | SharePoint Saturday Austin 2013
HOTFIX ITEMS
Main Development Branch• vNext Items
Production Support Branch
• Hotfixes
QA Environment
Pre-Production & Production EnvironmentsAccess Granted
Deployed to Production
MergeChanges
35 | SharePoint Saturday Austin 2013
• How to Build SharePoint Projects with TFS Team Buildhttp://msdn.microsoft.com/en-us/library/ff622991.aspx
• SharePoint/TFS Continuous Integration Starter Packhttp://sharepointci.codeplex.com/
• TFS 2010 & Sharepoint 2010: automated build and deploy (remotely)http://www.rightpoint.com/community/blogs/viewpoint/archive/2011/06/19/tfs-2010-amp-sharepoint-2010-automated-build-and-deploy-remotely.aspx
• Create a Custom WF Activity to Sync Version and Build Numbershttp://blogs.msdn.com/b/jimlamb/archive/2010/02/12/how-to-create-a-custom-workflow-activity-for-tfs-build-2010.aspx
• Ewald Hofman - Customzie Team Build 2010 Parts 1 – 16http://www.ewaldhofman.nl/post/2010/04/20/Customize-Team-Build-2010-e28093-Part-1-Introduction.aspx
REFERENCES
PLEASE FILL OUT SESSION EVALUATIONS ANDTHANK YOU FOR
ATTENDING!
37 | SharePoint Saturday Austin 2013
THANKS TO OUR SPONSORS!