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)?
Asked
Active
Viewed 8,499 times
4 Answers
6
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%

skolima
- 31,963
- 27
- 115
- 151
-
Is there any practical difference between using `/t:Package` versus `/t:Build /p:IsPackaging=True`? – JohnC May 04 '15 at 00:12
3
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"

Phill Duffy
- 2,805
- 3
- 33
- 45
1
Also to package project with msbuild you can use target Package:
Define new target "BuildAndPackage"
<Target Name="BuildAndPackage"> <CallTarget Targets="Build"/> <CallTarget Targets="Package"/> </Target>
Use new target in build process:
<Project ToolsVersion="4.0" DefaultTargets="BuildAndPackage">
But this approach not recommended because it may cause errors in TFS Build process..

gdbdable
- 4,445
- 3
- 30
- 46
0
Set the MSBuild's verbosity to 'maximum' and you should see what is called from the build console.
In VS2010 of course :)

leppie
- 115,091
- 17
- 196
- 297
-
I set it to 'Diagnostic' before, the amount of noise it generated made it impossible to find anything. – skolima Sep 16 '10 at 13:03