开发者

Avoid Visual Studio removing strings from resx file

I'd like to manually add some additional strings to the resx file associated with a WinForms class. This works fine, and I can access these strings using a ResourceManager.

But as soon as I modify the form using Visual Studio designer, it rewrites the resx file and thus deletes my st开发者_运维知识库rings.

Is there any way to prevent Visual Studio designer from doing this?

(Please don't ask why I want to manually add some strings to the resx file. I just do.)


Instead of find a way to prevent Visual Studio designer from doing this. You should NOT put your non-GUI related resource in these files. Just because VS maintain these files.

For customized resource, icon, images, files, strings, you can add a resource file to your project, and a wrapper class will be generated whenever you modify the customized resource file.

You can select this file type in the Add File dialog(CTRL + SHIFT + A), it's category is "General". A companion file *.Designer.cs will be generated(And added to your source code server if you have configured your VS in this way) automatically, and linked under the *.resx file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜