Question

How do I remove deployed feature elements using a feature-version?

i.e. given:

<Feature Title="Some functionality" Id="cae1f65d-0365-42e9-9907-356c7983e902" Scope="Site">
  <ElementManifests>
    <ElementManifest Location="SomeFunctionality\Elements.xml" />
    <ElementManifest Location="SomeMoreFunctionality\Elements.xml" />
  </ElementManifests>
</Feature>

a new Version might look like this:

<Feature Title="Some functionality" Id="cae1f65d-0365-42e9-9907-356c7983e902" Scope="Site" Version="1.0.0.0">
  <VersionRange BeginVersion="0.0.0.0" EndVersion="0.9.9.9">
    <ApplyElementManifests>
      <ElementManifest Location="SomeFunctionality_Iteration2\Elements.xml" />
    </ApplyElementManifests>
  </VersionRange>

  <ElementManifests>
    <ElementManifest Location="SomeFunctionality\Elements.xml" />
    <ElementManifest Location="SomeMoreFunctionality\Elements.xml" />
  </ElementManifests>
</Feature>

How do I, in the next version, remove SomeFunctionality\Elements.xml? Is it "enough" to simply remove the file from the solution and the reference from the feature?

In essence: I'm looking the opposite of ApplyElementManifests...

Was it helpful?

Solution

In Short: This is not possible declaratively.

(The long version: remove the Elements.xml from featue/solution and write a FeatureReceiver to undo the now unwanted modification done by the previous version.)

Personally I ended up removing the Element.xml from the feature and additionally I wrote a little PowerShell script (using CSOM) to ensure the unwanted elements were really removed. (I.e. remove column from ContentType & SiteColumns etc.)

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top