Wednesday, 20 April 2011

WSPBuilder per project configuration

When upgrading a custom SharePoint workflow recently I came across a useful feature of WSPBuilder, per project configuration.
WSPBuilder has its own config file WSPBuilder.exe.config which can be overridden in a visual studio project to provide custom settings for that specific project. All you have to do is add a copy of the file to your project from the installed location of WSPBuilder and uncomment any setting you want to override.

<?xml version="1.0" encoding="utf-8" ?>
 <add key="BuildDDF" value="false" />
 <add key="TraceLevel" value="3" />
 Optional settings
 You can set the arguments in this file or use them directly in the console.
 All arguments has a defualt value. See wspbuilder -help
 <add key="12Path" value="" />
 <add key="80Path" value="" />
 <add key="BinPath" value="" />
 <add key="BuildCAS" value="" />
 <add key="PermissionSetLevel" value="" />
 <add key="BuildSafeControls" value="" />
 <add key="BuildWSP" value="" />
 <add key="Createfolders" value="" />
 <add key="DeploymentTarget" value="" />
 <add key="Destination" value="" />
 <add key="DLLReferencePath" value="" />
 <add key="Excludefiletypes" value="" />
 <add key="ExpandTypes" value="" />
 <add key="Help" value="" />
 <add key="IncludeAssemblies" value="" />
 <add key="IncludeFeatures" value="" />
 <add key="Includefiletypes" value="" />
 <add key="ManifestEncoding" value="" />
 <add key="Outputpath" value="" />
 <add key="ResetWebServer" value="" />
 <add key="Silence" value="" />
 <add key="SolutionId" value="" />
 <add key="SolutionPath" value="" />
 <add key="WSPName" value="" />
 TraveLevel switch controls the general messages. In order to 
  receive general trace messages change the value to the 
  appropriate level. 
  Possible values :
  "0" gives no messages
  "1" gives error messages
  "2" gives errors and warnings
  "3" gives information
  "4" gives verbose information 
 The default value in WSPBuilder is Information (3).
In my case I needed to change the name of the .wsp file it generates to provide a new version of the workflow solution, so I set the WSPName value like this:
<add key="WSPName" value="VS.Sample.CustomWorkflow_v2.wsp"/>
Adding the config to projects in this way has a number of other benefits as well such as ensuring assemblies are not included if built accidentally or building to a specific network folder for example. Since it is part of the visual studio project it also ensures the wsp build settings are version controlled and all developers will build the wsp in a similar way.

No comments:

Post a Comment