1

I have been using a no code sandbox solution to deploy style related assets and display templates via a site collection feature. Each time we need to update these assets I do the following:

  • Update the asset (for example change styles in a css file)
  • Go to the feature and use the 'mainfest' tab to add in an upgrade action like the following:<UpgradeActions> <VersionRange BeginVersion="0.0.0.0" EndVersion="0.9.9.9"> <ApplyElementManifests> <ElementManifest Location="consto_StyleAssets\Elements.xml" /> <ElementManifest Location="consto_PageLayouts\Elements.xml" /> <ElementManifest Location="consto_Templates\Elements.xml" /> </ApplyElementManifests> </VersionRange> <VersionRange BeginVersion="1.0.0.0" EndVersion="1.9.9.9"> <ApplyElementManifests> <ElementManifest Location="consto_StyleAssets\Elements.xml" /> <ElementManifest Location="consto_Templates\Elements.xml" /> </ApplyElementManifests> </VersionRange> <VersionRange BeginVersion="2.0.0.0" EndVersion="2.9.9.9"> <ApplyElementManifests> <ElementManifest Location="consto_PageLayouts\Elements.xml" /> <ElementManifest Location="consto_StyleAssets\Elements.xml" /> <ElementManifest Location="consto_Templates\Elements.xml" /> </ApplyElementManifests> </VersionRange> <VersionRange BeginVersion="2.9.9.9" EndVersion="3.0.0.0"> <ApplyElementManifests> <ElementManifest Location="consto_PageLayouts\Elements.xml" /> <ElementManifest Location="consto_StyleAssets\Elements.xml" /> <ElementManifest Location="consto_Templates\Elements.xml" /> </ApplyElementManifests> </VersionRange> <VersionRange BeginVersion="3.0.0.0" EndVersion="3.9.9.9"> <ApplyElementManifests> <ElementManifest Location="consto_PageLayouts\Elements.xml" /> <ElementManifest Location="consto_StyleAssets\Elements.xml" /> <ElementManifest Location="consto_Templates\Elements.xml" /> </ApplyElementManifests> </VersionRange> </UpgradeActions>
  • Increase the feature version number of the feature
  • Upload the sand box wsp file to the site collection solution gallery
  • 'Upgrade' the sandbox solution after it has been uploaded.

Now this works well at times and when the feature is upgraded (as part of the sandbox solution upgrade) the correct files are re-deployed based on the 'Elements.xml' file specified in the feature upgrade xml.

The problem is at other times this does not work, the feature version is incremented (confirmed by getting the feature version number via powershell) but the files are not re-deployed at all, the only way to re-deploy the files is to deactivate and activate the feature.

I am sure that the elemnets.xml file is correct see below and it never changes unless I add a new file in.

 <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="consto_Templates"  Path="consto_Templates" Url="_catalogs/masterpage" RootWebOnly="TRUE">
    <!--DISPLAY TEMPLATES - JS FILES: -->
   <File ReplaceContent="TRUE"  Level="Published" Path="DisplayTemplates\consto_Calendar_Control_List.js" Url="consto_Templates/DisplayTemplates/consto_Calendar_Control_List.js" >
      <Property Name="Title" Value="consto Control Template - Calendar" />
      <Property Name="Description" Value="" />
      <Property Name="ContentTypeId" Value="0x0101002039C03B61C64EC4A04F5361F385106601" Type="string"/>
      <Property Name="TargetControlType" Value=";#Content Web Parts;#" />
      <Property Name="TemplateHidden" Value="FALSE" />
      <Property Name="DisplayTemplateLevel" Value="Control"/>
      <Property Name="HtmlDesignAssociated" Type="int" Value="0" />
    </File>
    <File ReplaceContent="TRUE"   Level="Published" Path="DisplayTemplates\consto_Control_List.js" Url="consto_Templates/DisplayTemplates/consto_Control_List.js" >
      <Property Name="Title" Value="consto Control Template - Generic" />
      <Property Name="Description" Value="" />
      <Property Name="ContentTypeId" Value="0x0101002039C03B61C64EC4A04F5361F385106601" Type="string"/>
      <Property Name="TargetControlType" Value=";#Content Web Parts;#" />
      <Property Name="TemplateHidden" Value="FALSE" />
      <Property Name="DisplayTemplateLevel" Value="Control"/>
      <Property Name="HtmlDesignAssociated" Type="int" Value="0" />
    </File>
    <File ReplaceContent="TRUE"   Level="Published" Path="DisplayTemplates\consto_Control_List_Paging.js" Url="consto_Templates/DisplayTemplates/consto_Control_List_Paging.js">
      <Property Name="Title" Value="consto Control Template - Generic with Paging" />
      <Property Name="Description" Value="" />
      <Property Name="ContentTypeId" Value="0x0101002039C03B61C64EC4A04F5361F385106601" Type="string"/>
      <Property Name="TargetControlType" Value=";#Content Web Parts;#" />
      <Property Name="TemplateHidden" Value="FALSE" />
      <Property Name="DisplayTemplateLevel" Value="Control"/>
      <Property Name="HtmlDesignAssociated" Type="int" Value="0" />
    </File>
    <File ReplaceContent="TRUE"   Level="Published" Path="DisplayTemplates\consto_Item_4Cols_Generic_Icon.js" Url="consto_Templates/DisplayTemplates/consto_Item_4Cols_Generic_Icon.js" >
      <Property Name="Title" Value="consto Item Template - Generic with Icon - 5 Columns" />
      <Property Name="Description" Value="" />
      <Property Name="ContentTypeId" Value="0x0101002039C03B61C64EC4A04F5361F385106603" Type="string"/>
      <Property Name="TargetControlType" Value=";#Content Web Parts;#" />
      <Property Name="TemplateHidden" Value="FALSE" />
      <Property Name="DisplayTemplateLevel" Value="Item"/>
      <Property Name="HtmlDesignAssociated" Type="int" Value="0" />
    </File>
  </Module>
</Elements>

Does any have an idea as to why this is happening?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.