Search code examples
c#silverlightvisual-studio-2010windows-phone-7resources

Trouble in Visual Studio 2010, changing resources is setting the constructor to internal


I am experiencing some weird behavior of Visual Studio 2010 when developing Silverlight applications and using project resources (.resx)

Everytime I change a resource it sets itself to internal instead of public in the code behind, altough I can see it in the design mode as set to public it is not.

Any idea how to fix this?

I don't know if this affects only Silverlight projects or generaly all C# projects.


Solution

  • This link might help.

    http://blogs.msdn.com/b/silverlight_sdk/archive/2010/09/08/ach-du-lieber-a-tour-of-some-localization-gotchas-in-silverlight.aspx

    It says:

    Turns out there's a flaw in the VS build action logic here; unfortunately changing this tool action will NOT flip the access level of the class constructor from internal to public (at least not for a strongly typed language). A public constructor is another requirement of Silverlight XAML usage of a class. You will have to do this yourself manually in the designer.cs file.

    Hope this helps

    EDIT:-

    Here's another one http://www.wintellect.com/CS/blogs/jprosise/archive/2010/06/21/dynamic-localization-in-silverlight.aspx that says

    Finally, Visual Studio suffers from a long-standing bug that leaves the constructor of the ResourceManager wrapper class it generates marked internal when you change the class's access modifier to public. This means that whenever you modify the primary RESX file, forcing a code regen, you have to manually change internal to public on the constructor in the generated code. It beats me why this hasn't been fixed after all these years, but it hasn't.