Search a CodePlex project


Project Description
Project mainly to provision feature property entries in WSP solution files.

Have you ever got a SharePoint WSP solution which has embedded configuration files and some of them are intended to be changed via the pre-configured properties file similar like the following:

<Feature  Id="52675634-060D-4D75-BB34-70680F7CF741"
          Title="My very own feature"
          Description="This is the description of this feature"
          Scope="Site"
          Version="14.0.0.0"
          xmlns="http://schemas.microsoft.com/sharepoint/"
          ReceiverAssembly="MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ad797cdf7ad7f989"
          ReceiverClass="MyAssembly.MyVeryOwnFeature">
    <Properties>
        <Property Key="Property1" Value="Default Value 1" />
        <Property Key="Property2" Value="Default Value 2" />
    </Properties>
</Feature>


So the properties "Property1" and "Property2" are intended by the developer of the feature to be changed -- of course only in the way intended by the provided documentation of the appropriate feature ;-). The values provided by the property definition are only intended as default values.
So far, so good.

But how can those values be changed easily according to the fact that they are embedded in a WSP file?

One way could be to deploy the WSP file in a regular way (e.g. by the Central Administration or by PowerShell scripts) and then change those values in the 14 hive. But this means that after changing those values, the affected feature have to be re-deployed to properly deploy them on all appropriate SharePoint member servers. In summary this way needs some (or many) manual extra steps and so is time consuming and error prone.

Another way could be to change WSP solution to adjust those default values to the needed ones. The charm of this way is that one have the correct WSP solution for an easy deployment which is subject to be deployed on other machines (n-tier environment) or to be re-deployed in case of trouble on the current SharePoint farm.

WSP files rely on the CAB format, but the management possibilities provided by PowerShell and the operating system are very limited.

So the purpose of this project is to provide a .NET assembly which is able
(a) to identify property sections in WSP feature files and creates a default configuration file which is intended to be modified and
(b) to push the property values of this configuration file back to the WSP feature files.


Sample Usage

All script-based samples are provided as PowerShell script excerpts.

The following example analyzes a given SharePoint solution WSP file "MySharePointSolution.wsp" for property sections in feature files and creates a settings file "MySharePointSolution.settings":

[Reflection.Assembly]::LoadFile('CabConfigProvisioning.dll') | Out-Null
$a = New-Object CabConfigProvisioning.WspConfigCreator "MySharePointSolution.wsp", "MySharePointSolution.settings"
$a.Execute()



The following example takes a given SharePoint solution WSP file "MySharePointSolution.wsp", applies the given feature property values from "MySharePointSolution.settings" to them. As result a new WSP solution file "MySharePointSolution-Configured.wsp" is created reflecting the new property values. This new WSP file is subject for deployment purposes.

[Reflection.Assembly]::LoadFile('CabConfigProvisioning.dll') | Out-Null
$a = New-Object CabConfigProvisioning.WspConfigProvisioner "MySharePointSolution.wsp", "MySharePointSolution-Configured.wsp", "MySharePointSolution.settings"
$a.Execute()


Based on the above sample feature file, the settings file holding the needed property values could look like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <file path="MyVeryOwnFeature\Feature.xml">
        <property key="Property1" value="My Value 1" />
        <property key="Property2" value="My Value 2" />
    </file>
</configuration>











Not affiliated with Microsoft and CodePlex
To remove your project or any question, please contact us: [email protected]