Answered by:
RESX files and Sandbox solution

Question
-
Hi all,
I know this question has been asked before, but is there a way to develop features such as web parts in sandbox solutions that are localized. I cannot imagine that being impossible!
Thanks in advance
Julien http://www.sharepointofview.fr/JulienFriday, July 30, 2010 11:42 AM
Answers
-
You cannot use .resx files (or .resource) files in a sandboxed solution. To localize a sandboxed solution, you need to use satellite assemblies. Search MSDN for "satellite assemblies" for links to relevant topics.
Rick- Proposed as answer by RickeeMicrosoft employee Tuesday, August 10, 2010 12:46 AM
- Marked as answer by Chakkaradeep Chandran Sunday, August 22, 2010 11:45 PM
Monday, August 9, 2010 11:34 PM
All replies
-
According to http://msdn.microsoft.com/en-us/magazine/ee335711.aspx , unfortunately, you cannot use visual Web Parts in the sandbox because sandboxed solutions can’t deploy files to the Web front end, which is where the .ascx files need to be deployed.
Monday, August 2, 2010 6:16 AM -
Thanks for you answer, but i meant resx files, not ascx :-)
Julien http://www.sharepointofview.fr/JulienWednesday, August 4, 2010 7:17 AM -
You cannot use .resx files (or .resource) files in a sandboxed solution. To localize a sandboxed solution, you need to use satellite assemblies. Search MSDN for "satellite assemblies" for links to relevant topics.
Rick- Proposed as answer by RickeeMicrosoft employee Tuesday, August 10, 2010 12:46 AM
- Marked as answer by Chakkaradeep Chandran Sunday, August 22, 2010 11:45 PM
Monday, August 9, 2010 11:34 PM -
Using localized string in a sandbox solution IS possible... its impossible on the other side to deploy it via a sandbox solution...
You can also use assembly embedded resx file...
Suppose you have had a resource named "LocalizedString1" (in a c# project properties) and you want to use the resource
void samplecode() { //Set localized string to a label text property myLabel.Text = Properties.Resources.LocalizedString1; }
Tuesday, August 10, 2010 12:04 AM -
its impossible on the other side to deploy it via a sandbox solution...
That's not completly true.You can use .resx files for features and elements files, like this;
Add a resource file to your feature
- Right-click your feature and choose ‘Add Feature Resource…’.
- Select the appriopriate culture and click OK.
- Repeat these steps for the other cultures.
Now you see one or multiple .resx files within your feature folder. These files will be deployed to a new Resources folder within the feature folder and are only usable within your feature (feature.xml, elements.xml, etc.) (Do not set the Default Resource File property on your feature).
Wednesday, July 6, 2011 2:21 PM -
its impossible on the other side to deploy it via a sandbox solution...
That's not completly true.<snip>
These files will be deployed to a new Resources folder within the feature folder
</snip>
Actually, there is no feature folder for a feature inside a sandboxed solution because deployment of a sandboxed solution cannot touch the file system. Instead the feature and its resx files remain inside the wsp file in the content database.
Rick - MSFTWednesday, July 6, 2011 10:02 PM -
Correct, (sorry, missed to change that in the copy/paste) however this will work in sandboxed solutions.Friday, July 8, 2011 3:27 PM