MSBuild Properties Supported by SharePoint

MSBuild Properties Supported by SharePoint

 

Any MSBuild property defined in the Microsoft.VisualStudio.SharePoint.targets file, project file, or project user file can be used in Visual Studio SharePoint projects. In addition to the common MSBuild properties supplied by the project, SharePoint defines additional properties that are specific to SharePoint projects.

For a list of common MSBuild properties, see Common MSBuild Project Properties. For a full list of the properties supported by your programming language, look in the .targets file, the project file (.csproj or .vbproj), or the project user file (csproj.user or .vbproj.user).

The following table lists MSBuild properties that apply specifically to SharePoint projects in Visual Studio. Other properties exist, but they are for internal use.

Property NameDescription
SharePointSiteUrlA string that represents the URL to the SharePoint site.
SandboxedSolutionA Boolean value that indicates whether the solution is a sandboxed solution.
ActiveDeploymentConfigurationThe active deployment configuration.
IncludeAssemblyInPackageA Boolean value that indicates whether the assembly is included in the package file.
PreDeploymentCommandA string value that represents the command to execute in the pre-deployment command step.
PostDeploymentCommandA string value that represents the command to execute in the post-deployment command step.
CustomBeforeSharePointTargetsA string that represents the path of a MSBuild targets file. If the targets file exists and is defined, it is imported before any SharePoint targets data. This property lets you customize the package process by predefining packaging-related properties without modifying the shipped SharePoint targets file, yet the targets file still applies to all SharePoint projects.
CustomAfterSharePointTargetsA string that represents the path of a MSBuild targets file. If the targets file exists and is defined, it is imported after all of the SharePoint targets data. This property lets you customize the package process by overriding packaging-related properties and targets without having to modify the shipped SharePoint targets file, yet the targets file still applies to all SharePoint projects.
LayoutPathA string that represents the root directory where each of the files to be packaged are temporarily placed before they are added to the .wsp file. This path can be useful to know when you override the BeforeLayout and AfterLayout targets to add, remove, or modify files to be packaged, because you can use it to alter the contents of the .wsp file.
BasePackagePathA string that represents the folder in which the package is placed. This value uses the output directory of the project, such as Bin\Debug.
PackageExtensionA string that represents the file name extension to append to the package. The default value is wsp.
AssemblyDeploymentTargetA string that represents the location where the project assembly is deployed on the SharePoint server. Its value is either GlobalAssemblyCache (the default) or WebApplication. This property can also be set in the Properties window.
PackageWithValidationA Boolean value that specifies whether validation is performed before packaging. This property lets you ignore validation errors while building Packages.
ValidatePackageDependsOnA string that defines additional targets to execute before the ValidatePackage target.
TokenReplacementFileExensionsA string that defines the files that have their tokens replaced during packaging.

For flexibility, instead of using hard-coded strings in the Pre-deployment Command Line and Post-deployment Command Line boxes on the SharePoint Properties page, you can use the SharePoint properties as arguments. For example, instead of specifying a specific URL string for the SharePoint site, you can instead use $(SharePointSiteUrl).

System_CAPS_ICON_note.jpg Note


You can use either the MSBuild variable syntax $(propertyName) or the environment variable syntax %propertyName% to specify a property.

MSBuild Reference

Show:
© 2016 Microsoft