3

I asked a question maybe yesterday or two days ago tops about using ScriptResx.ashx with custom resource files. I noticed that at first my custom file wasn't being rendered through the handler because it was missing a chunk of code that the handler requires:

<!-- 
    Whether this .resx could be read by scriptResx.ashx handler. Only a file
    marked with scriptResx:true could be returned to client.
 -->
 <resheader name="scriptResx">
    <value>true</value>
 </resheader>
 <!-- the full name of the JavaScript class.  -->
 <resheader name="classFullName">
   <value>Custom.Resources.Global</value>
 </resheader>

Once I figured that out, I got my .resx file working -- until I added another property. Once you add a property via the Visual Studio Designer it re-writes the entire file, removing that needed code.

Does anyone have any tricks, tips or Visual Studio templates that will allow me to preserve that block of code while still allowing me to add resources via the Design view?

2
  • Stupid problem. I don't know of any way to fix this...
    – Dennis G
    Commented Apr 8, 2014 at 16:56
  • 2
    @DennisG I don't know if you still need this, but if you do - check the tool I have linked in my answer below. Commented Jun 12, 2014 at 14:07

1 Answer 1

2

Don't know if the OP still need this, but I hope it may be usefull to anyone experiencing the same issue.

Turn out that Wictor Wilén has built a visual studio extension that manages the aforementioned setting automatically. You can find it on the Visual Studio Gallery under the name "SPResX Visual Studio 2012 Extension". It also offer the ability to customize the "namespace" of the generated javascript class.

Link to the original blog post

1
  • Awesome! Good thing I favorited this question.
    – Dennis G
    Commented Jun 13, 2014 at 5:37

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.