How do I get the Windows Forms Designer to use resources from external assembly?

霸气de小男生 提交于 2019-12-01 03:56:01

Nope, the designer doesn't support this. Important that it works the way it does, localization through satellite assemblies wouldn't work otherwise.

You can do this but you have to write the code yourself. Pretty much what you find in the Resources.Designer.cs file. Do consider if this is worth the effort, it isn't very maintainable and sharing resource assemblies isn't much of an optimization. A terabyte disk is less than a hundred bucks.

Btw: never edit the Resources.Designer.cs file yourself.

Kohanz

I have the exact same problem and there may be an alternative approach, depending on your code-base. If the properties that have been modified to reference a specific resource are on custom controls, then you could add the [[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] attribute to those properties (override or hide them, if necessary) and the Designer will leave them alone.

However, if the properties are on basic UI elements (e.g. Form.BackgroundImage) then you'd have to have to override or hide those as well and I'm not sure how desirable that is.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!