简体   繁体   中英

c# Winforms share resources between projects

I have a solution that contains 2 winforms app and a classlibrary referenced by the 2 apps... I added some images in resource

类库资源

but when I go on the winform app and try to add the image into a button appears this:

加载资源

Is there a way to do this?

thanks

You have to make resource items public instead internal.

To do this, in .resx file in solution explorer select Property Window (Alt+Enter) and in File Properties -> Custom Tool should be ResXFileCodeGenerator

Change this option to PublicResXFileCodeGenerator (if option don't show in dropdown field, don't worry aboit it, write/type PublicResXFileCodeGenerator in field)

After that resources member class will be generated with public modifier and you can access to it from any project that reference assembly.

I hope it can help you!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM