Friday, April 6, 2012

SharePoint Resource file issues

Scenario:
Working on some of the recent projects I faced some weird Resource file based issues. Actually these errors shows up during Feature activation. So doing a quick post on workarounds that worked for me.Leave comments if you found a more appropriate answer

Error type (1):
Failed to read resource file "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Template\Features\myProject_SiteFeature\Resources\Resources.en-US.resx" from feature id "GUID".

Failed to open the file 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Template\Features\myProject_SiteFeature\Resources\Resources.en-US.resx'.

What I did: After googling / investigating my logs with Error co-relation ID , I realized that these can be skipped. Real cause of this error is something else and will recommend to start analyzing the logs from oldest to newest. Doing so I was able to find the real cause of the issue.

Error type (2):
Failed to find resource file "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Resources\myProjectResources.en-US.resx" from feature id "GUID".

What I did: In my project I was using "myProjectResources.resx" file but it was looking for "myProjectResources.en-US.resx", which is weird. To fix the issue, I create a copy of existing "myProjectResources.resx" file and redeployed. It worked for me.

2 comments:

Milind Saraswala May 8, 2013 at 6:48 AM  

Thank you buddy its work for me, but do you have any idea why it was happen so we stop this in future

Sandeep May 8, 2013 at 9:23 AM  

May be you can include en-US file also in the project itself so that it get deployed along with main file