3

We have this situation: there was an error in teh solution, which occured in one of JS files deployed into _layouts.

Bug was kind of a critical, and decision was made to push chaned JS file by hand into layouts folder (YESS, I know, not suppoeted etc. - will never do that again, promise!). And that worked. We also incorporated changes in IDE, not to loose changes for future release.

Along the way we made some other changes in solution, which also changed the JS file. We performed update of solution: uninstalling, removing, adding and installing again on web app. Everything worked, except our JS file, which was not updated and there is still a version of file which was modified by hand.

Did you ever had same situation? is it possible to overcome in some civilized way? Powershell maybe?

2

This "error" occurs when you manually change the file directly in the layouts folder instead of through the solution w/ deploy.

Try deleting the js file from the layouts folder on the drive, check that the js file is included in the package file in your solution, then deploy the solution. It should put a fresh copy of the js file into the layouts folder on the drive again and should be updateable again with feature deploys.

| improve this answer | |
  • So basically when file is modified by hand in layouts directory, updating solution (without file deletion) will not overwrite this file? – jjczopek Dec 21 '13 at 17:17
  • @jjczopek In my experience, yes. This is what I have needed to do to fix it. – user2536 Dec 21 '13 at 20:24
  • This may or may not happen depending on the way you edited the file. With some editing tool, the file owner/permissions/locks/etc may be changed, and the process doing the WSP update cannot access the file anymore after that according to my experience... – Evariste Jul 21 '15 at 8:26
2

Finally, I found an another solution for this critical problem. Cause we modified directly js or CSS or some files of Front End in the server SharePoint, "IIS" will keep the original files as web content cache, even we did Ctrl+F5 or empty the cache in browser, that doesn't work at all. I tested many times in that way. So we need Expire the web content in WFEs.

Resolution:

  1. Just delete manually in your servers, both in WFE and Server App. And redeploy again your WSP, it should be worked as normal. (Mentioned above)
  2. Go to IIS server => select your site => choose "HTTP Response Headers" => Actions => Set Common Headers => Check "Expire Web content" and Click Ok => check again "Expire web content" and click ok.
| improve this answer | |
0

If the js file was not updated in _layouts folder after installing solution than it's a problem with js file in you current solution. If the file was not updated only for users than that is caching issue and could be resolved using MakeBrowserCacheSafeLayoutsUrl. Based on last modification this itself generate a MD5 hash code and append it to js urls. Examples:

<script type="text/javascript" src="<%=SPUtility.MakeBrowserCacheSafeLayoutsUrl('custom js relative path', false)%>"></script>
| improve this answer | |
  • Unfortunately this isnt cache issue, because I investigated this file in layouts folder in 14 hive, and confirmed that file was not modifed - it has wrong modification date (when it was first replaced by hand) and contents of file is out of date. – jjczopek Dec 21 '13 at 17:19
0

I did the same thing too, and the result is the disaster... However one solution is adding "?Rev=2" after the link of your js. I hope this could help you.

| improve this answer | |
  • 1
    Would you please elaborate your answer with some more details of what you did and how really it got solved. It will be help for other users. – Asad Refai Jul 21 '15 at 9:01
  • Sure. Thank you for your advise. I will do it next time. – Jio Jul 22 '15 at 9:25

Your Answer

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

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