Thursday, October 6, 2011

How to name WSP file in SharePoint WSPBuilder

I hope one of the favourite tools for any SharePoint developer is WSPBuilder. With this tool you do not have to worry about creating and deploying solution packages i.e. WSPs.

 

By default the WSPBuilder takes the project name as the wsp file name. In this article I will show how to give a custom name to the wsp file. The proper naming of the wsp file becomes a requirement while deploying WSPs in enterprise level where the WSPs should have the company name, then project name etc.  A similar kind of requirement forced to dig inside to figure out how we can do this very easily.

 

To override the default settings in WSPBuilder from inside the IDE is easy. Just create an xml file (Project > Add New Item > XML File) in your project and give the name as WSPBuilder.exe.config. Now copy the required contents from the default WSPBuilder.exe.config file which resides in

C:\Program Files (x86)\WSPTools\WSPBuilderExtensions or

C:\Program Files\WSPTools\WSPBuilderExtensions

 paste it in your config file. Once done it would look like:

 

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

  <appSettings>

    <!--

     Give the desired Name for the wsp

    -->

    <add key="WSPName" value="" />

   

  </appSettings>

</configuration>

 

The solution would look like below:

clip_image002

Apart from renaming the WSP filename we can also perform lot of activities by modifying the config file such as deploying in the virtual folder under inetpub etc. I am putting the whole config file below to explore. J

 

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

  <appSettings>

    <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).

    -->

  </appSettings>

</configuration>  

 

Thanks for reading. If you have some other explanation – please post a comment… I’ll be happy to hear.

 

...HaPpY CoDiNg

Partha (Aurum)

References:

http://www.zimmergren.net/archive/2009/04/08/wspbuilder-walkthrough-of-the-visual-studio-add-in.aspx

 

http://weblogs.asp.net/bsimser/archive/2009/11/26/name-that-wsp-sharepoint-developer-tricks-with-wspbuilder.aspx

 

 

No comments:

Post a Comment