6

I have a number of SharePoint web part projects in a single solution. To deploy a web part, I am using the "Publish..." option from solution explorer in visual studio. Then use the stsadm.exe to deploy them on SharePoint server.

enter image description here

Is it possible to generate a *.wsp package from the command line?

Shahed
  • 898
  • 1
  • 12
  • 25

1 Answers1

8

You can use msbuild tool to generate wsp packages.

Below you can find example of cmd script:

set msbuild="C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe"
set config=Release
set outdir2=C:\out\
rd /S /Q "%outdir2%"
%msbuild% /p:Configuration=%config% /m "C:\Test\test.csproj" /t:Package /p:BasePackagePath=%outdir2%
for /F "tokens=*" %%i in ('dir /B /S "%outdir2%"') do if not %%~xi == .wsp del %%i
Yevgeniy.Chernobrivets
  • 3,194
  • 2
  • 12
  • 14
  • @Yevgeniy.Chernobrivets What's about multiple SharePoint projects in one solution? – Alex Zhukovskiy Feb 05 '15 at 07:18
  • 1
    You can specify separate msbuild call for each sharepoint project in your solution. If you ask if you can pull all sharepoint projects from solution file and then create wsp packages for all of them i would say it is possible but i haven't done it. – Yevgeniy.Chernobrivets Feb 05 '15 at 10:31