Deploy a SharePoint solution with TFS

Developing SharePoint Solutions in your development enviroment is a lot of fun! Visual studio will help you a lot when it comes to testing these types of solutions by making the deployment proccess a breeze.
All you have to do is press F5 and, MAGIC HAPPENS! Visual Studio will package your solution, deploy it to the pre-configure site and activate the features for you. When this is all done, it opens a browser for you, so you can test it all. Nice integration stuff, all created for you by Microsoft. So far, so good! But when it comes to integration this into your DTAP (Development, testing, acceptance and production) process, its a whole different ballgame. I welcome you into the world of TFS (Team Foundation Server).

  • A Windows Domain (active directory, with working DNS)
  • A working TFS environment
  • A working Development environment
Initial server configuration
  1. Create a new “virtual” machine
    ServerName: SP01
  2. Add server roles
    Application Server
    .NET Framework 3.5.1
    Web Server (IIS) Support
    Windows Precess Actiovation Service Support
    HTTP Activation
    IIS 6 Management Compatibility
  3. Install SQL server 2008 (SP3)
  4. Add firewall rules for SQL (Port 1433 OPEN)
  5. Install SharePoint 2010 (With servicepacks / cumulative updates)
  6. Install Team Foundation Build Service
    Add Build Controller
    Add Build Agent
SharePoint Specific configuration
  1. Add accounts to local admin
  2. Copy TFS SharePoint files / gacutil
  3. Create new TFS Project
    Add new “” project
    Delete created project
    Add new project – “Branding”
    Rename fiolder in TFS to DEV
    Convert to branch “DEV”
  4. Create PowerShell script for webapplication
    Add GlobalFunctions.ps1
    Add 1_CreateFarm.ps1
    Add 2_CreateWebApplication.ps1
    Add xml config file
  5. Create Build Definition
    workspace: $/ — $(SourceDir)
    msbuild arguments: /p:IsPackaging=True
    droplocation: SP01DropFolder (share needs read/write for svc-tfs user)
Fase 1 completed, build of initial WSP file can nowbe tested!
Fase 2: Create Build Template
  1. Add Sequence “Run BuildPlay Script” after “Try Compile, Test, and Associate Changesets and Work Items”
  2. Add variabeles DeploymentScriptFilename – String – Sequence Start
  3. Add arguments buildPlayLocation – In – String
  4. Add ConvertWorkspaceItem DisplayeName: Convert deployment script filename Input: buildplayLocation Result: DeploymentScriptFilename Workspace: Workspace
  5. Add InvokeProcess Arguments: String.Format(” “” $BinaryPath='{1}’; $IsBuildServer='{2}’; “” “”& ‘{0}’ “” “, DeploymentScriptFilename, BinariesDirectory, “$True”) Displayname: execute deployment script FileName: “PowerShell”
  6. Add WriteBuildMessage Importance: Microsoft.TeamFoundation.Build.Client.BuildMessageImportance.High Message: stdOutput
  7. Add WriteBuildError Message: errOutput
Configure SharePoint server side
  1. Run scripts on server
    $IsBuildServer = $true
  2. Add svc-tfs acount to content db as db_owner
  3. Restart server
  1. Add BuildPlay scripts…
  2. Copy SharePointDeploymentTemplate.xaml into BuildProcessTemplates (or create a new one)
  3. Choose SharePointDeploymentTemplate.xaml as template
    BuildPlay location: $/
  4. Run build script

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s