Tuesday 5 April 2011

SharePoint 2010 WSP Packaging on TFS Build Server

I thought I'd make a not of this so I remember it. When VS builds a SharePoint 2010 project, it doesn't automatically create a WSP package (it does this on deploy). This is fine in the development environment, but when it comes to using a build server, the WSP must be created on build. I've found 2 ways of doing this.

1. When queuing a build, the following MSBuild arguments can be specified to package the project:

/p:IsPackaging=True



I found the first here:

http://msdn.microsoft.com/en-us/ff622991.aspx

2. To save doing this everytime a build is made, the following modification can be made the the project file:

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets" />
  <PropertyGroup>
    <BuildDependsOn>$(BuildDependsOn);CreatePackage</BuildDependsOn>
    <PreBuildEvent>

    </PreBuildEvent>
  </PropertyGroup>


If found the second here:

http://www.sharemuch.com/2010/03/23/how-to-package-on-build-in-your-visual-studio-sharepoint-2010-solution/

2 comments:

  1. good article on wsp package it will help you a lot in deployment.

    ReplyDelete
  2. You can just add this to the build definition.

    - Right mouse click on the build defintion
    - Edit
    - Select Process
    - Expand Advanced
    - In MSBuild Arguemnts, add /p:IsPackaging=True
    - Save

    All subsequent builds will automatically generate the WSP.

    I supposed you could do this in the Build Template as well.

    ReplyDelete