10

Having an issue updating files with a feature. This is for custom branding. here is a sample of the elements.xml file. If I add a new file, it will provision fine, but any changes to existing files won't. Tried reactivating feature, retracting/redeploying, IISResets, IgnoreIfAlreadyExists attribute, and Rebooting of server. Is there anything that might cause these to not provision correctly?

  <File Url="images/website_icon.png" Type="GhostableInLibrary" />
    <File Url="images/apply_now.png" Type="GhostableInLibrary" />
    <File Url="images/btn_applynow.png" Type="GhostableInLibrary" />
3
  • I eventually fixed the problem by deleting the root folder of all the files that were being provisioned and it worked again. Something was hung up with updating existing files and I could never figure out what.
    – Shane
    Commented Apr 29, 2011 at 20:37
  • Just curious, what is the version of the SharePoint that you are experiencing this? In my SP2010, i am experiencing same behavior when using update-spsolution but it also happens to CSS published GhostableInLibrary as well. VS2010 development tools seems to be updating properly though
    – Roman
    Commented May 4, 2013 at 1:13
  • This was SharePoint 2010 and Visual Studio 2010. Never did find 100% solution, just used workaround. This project has been done for a few years though.
    – Shane
    Commented May 6, 2013 at 14:35

5 Answers 5

3

The module element won't replace files that have already been provisioned.

You'll need to delete them from Feature deactivating if you want to re-provision files in a feature.

4
  • But I'm able to do this with CSS files all the time. For example, I make a change to my primary CSS within VS2010, then provision it and it updates. The CSS is setup in the same was in a module
    – Shane
    Commented Apr 25, 2011 at 19:49
  • Hmm, browser cache?
    – James Love
    Commented Apr 25, 2011 at 20:00
  • 2
    To verify press ctrl+f5 Commented Apr 26, 2011 at 6:03
  • Not a CTRL-F5 issue, if I looked at the files in the style library, the files aren't getting updated. Like I said, my workaround was just to delete the folder all together and then it seemed to start working. This works for the Style library folder, but not when doing page layouts because I can't delete that folder.
    – Shane
    Commented May 29, 2011 at 0:23
1

It this is your dev server, try to use "copy to 12 hive" in context menu in visual studio (you need cksdev for this feature to be available).

If updating the artifacts this way doesnt work, the files have been unghosted, probably by gui or SharePoint designer.

Notice also that publishing pages will get special meta tags at the start of the document if they are created in SharePoint designer, triggering customization even if files are provisioned with modules and ghostableinlibrary!

Also please describe the specifics on your provisioning. Are you using visual studio or PowerShell? Upgrade solution or a full uninstall, remove, add, install? How do you activate features? Do you have feature eventhandler code? Note that upgrading solution will not register added or deleted artifacts...

4
  • Made sure that noone is modifying the files in designer or Web UI, therefore all files stay ghosted.
    – Shane
    Commented Apr 25, 2011 at 20:58
  • Using PowerShell to do an Update-SPSolution, but have tried retracting/redeploying, etc.
    – Shane
    Commented Apr 25, 2011 at 20:58
  • Did you try any of my other suggestions? Commented Apr 26, 2011 at 6:03
  • I'd been trying with full retract and deploy using PowerShell. I'm able to use a workaround by deleting the folder in Style Library, but have yet to get to the root of the problem.
    – Shane
    Commented May 29, 2011 at 0:25
1

Add attribute ReplaceContent="TRUE" and it should work e.g.

<File Path="Styles\css\ApplicationStyle.css" Url="css/ApplicationStyle.css"  ReplaceContent="TRUE" Type="GhostableInLibrary" />
1
  • this is only applicable to SP2013.
    – Roman
    Commented Dec 23, 2015 at 2:44
0

I agree with Anders' comment. It sounds to me like a client issue, not a server issue. Definitely try ctrl-f5 first.

As has been mentioned, as long as the images are still ghosted and have not been modified manually (this can include SharePoint Designer or even someone uploading a new version), then your library is using the files from the web server, not from the content database. As long as the images are ghosted, you can update them on the server as many times as you would like. To get the images to the web server, upgrade or retract/deploy the solution package, but you should not need to reactivate the feature, run issreset, modify the elements file, or reboot. However, just because you update them on the server, it is possible that the client will continue to use the old version from their cache.

If ctrl-f5 does not work (and you are confident the images are still ghosted), I would double check that the files have been properly updated on the web server. Activate the feature in a fresh site and check that the new versions of the images appear. Also, if you have multiple WFEs, make sure that the feature has been updated on each server.

0

In case anyone ends up on this page like I did with a similar situation, my files had in fact become unghosted for unknown reasons. Borrowing and modifying a script found on the internet, I ran the following code to determine the status:

public static void CheckCustomizedStatus(string siteColURL, string listName, string[] filterExtensions)
{
        filterExtensions = filterExtensions.Select(ext => ext.ToLower()).ToArray();
        using (SPSite site = new SPSite(siteColURL))
        {
            SPList list = site.RootWeb.Lists[listName];
            foreach (SPListItem item in list.Items)
                if (filterExtensions.Contains(item.File.Name.Substring(item.File.Name.LastIndexOf('.')).ToLower()))
                    Console.WriteLine("File Name:\t{0}\\{1}\tStatus:\t{2}{3}", item.File.ParentFolder.ToString(), item.File.Name, item.File.CustomizedPageStatus.ToString(), item.File.CustomizedPageStatus == SPCustomizedPageStatus.Uncustomized ? " (Ghosted)" : string.Empty);
        }
}

which is called with a method similar to this:

CheckCustomizedStatus("http://yoursite.org", "Style Library", new string[] {".css"})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.