How to: Create a SharePoint Solution Package by using MSBuild tasks
Applies to: Visual Studio Visual Studio for Mac
Note
This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
You can build, clean, and validate a SharePoint package (.wsp) using command-line MSBuild tasks on a development computer. You can also use these commands to automate the build process by using Team Foundation Server on a build computer.
Build a SharePoint package
To build a SharePoint package
On the Windows Start menu, choose All Programs > Accessories > Command Prompt.
Change to the directory where your SharePoint project is located.
Enter the following command to create a package for the project. Replace ProjectFileName with the name of the project.
msbuild /t:Package ProjectFileName
For example, you could run one of the following commands to package a SharePoint project called ListDefinition1.
msbuild /t:Package ListDefinition1.vbproj msbuild /t:Package ListDefinition1.csproj
Clean a SharePoint package
To clean a SharePoint package
Open a command prompt window.
Change to the directory where your SharePoint project is located.
Enter the following command to clean a package for the project. Replace ProjectFileName with the name of the project.
msbuild /t:CleanPackage ProjectFileName
For example, you could run one of the following commands to clean a SharePoint project called ListDefinition1.
msbuild /t:CleanPackage ListDefinition1.vbproj msbuild /t:CleanPackage ListDefinition1.csproj
Validate a SharePoint package
To validate a SharePoint package
Open a command prompt window.
Change to the directory where your SharePoint project is located.
Enter the following command to validate a package for the project. Replace ProjectFileName with the name of the project.
msbuild /t:ValidatePackage ProjectFileName
For example, you could run one of the following commands to validate a SharePoint project called ListDefinition1.
msbuild /t:ValidatePackage ListDefinition1.vbproj msbuild /t:ValidatePackage ListDefinition1.csproj
Set properties in a SharePoint package
To set a property in a SharePoint package
Open a command prompt window.
Change to the directory where your SharePoint project is located.
Enter the following command to set a property in a package for the project. Replace PropertyName with the property that you want to set.
msbuild /property:PropertyName=Value
For example, you could run the following command to set the warning level.
msbuild /property:WarningLevel = 2