Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I build a SharePoint 2010 package using command line?

I have a Visual Studio 2010 SharePoint project. If I choose 'Package' from the project menu, a .wsp file is generated. How can I invoke the same build from command line (i.e. what /target is required for MSBuild)?

like image 436
skolima Avatar asked Sep 16 '10 12:09

skolima


2 Answers

I got it to work, finally. The tricky part is the fact that the SharePoint targets do not exist when MSBuild loads the .sln file, you have to load the individual .csproj files.

set msbuild="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"
set config=Debug
set outdir="C:\out\"
%msbuild% /p:Configuration=%config% /m ../My.SharePoint.Project/My.SharePoint.Projectcsproj /t:Package /p:BasePackagePath=%outdir%
like image 91
skolima Avatar answered Sep 19 '22 22:09

skolima


This is also a useful document here: http://msdn.microsoft.com/en-us/ff622991.aspx

"To generate packages when building in TFS 2010, set the parameter /p:IsPackaging=True on MSBuild"

like image 33
Phill Duffy Avatar answered Sep 19 '22 22:09

Phill Duffy