c# – 在Visual Studio 2010中遇到问题,更改资源是将构造函数设置为内部

在开发Silverlight应用程序和使用项目资源(.resx)时,我遇到了Visual Studio 2010的一些奇怪行为

每次我更改资源时,它都会在后面的代码中将自己设置为内部而不是公共,尽管我可以在设计模式中看到它设置为公共它不是.

知道如何解决这个问题吗?

我不知道这是否只影响Silverlight项目或一般所有C#项目.

解决方法:

此链接可能有所帮助.

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

它说:

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.

希望这可以帮助

编辑:-

这是另一个http://www.wintellect.com/CS/blogs/jprosise/archive/2010/06/21/dynamic-localization-in-silverlight.aspx说的

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.

相关文章

如何在Silverlight4(XAML)中绑定IsEnabled属性?我试过简单的...
我正在编写我的第一个vb.net应用程序(但我也会在这里标记c#,...
ProcessFile()是在UIThread上运行还是在单独的线程上运行.如...
我从同行那里听说,对sharepoint的了解对职业生涯有益.我们不...
我正在尝试保存一个类我的类对象的集合.我收到一个错误说明:...
我需要根据Silverlight中的某些配置值设置给定控件的Style.我...