开发者

using an image embedded in a directory of a dll

I have a .NET 4.0 class library with a directory called Resources, with an image called Logo.bmp inside it set to be compiled as an embedded resource.

In my main application I add the dll reference and set a Uri to pack://application:,,,/ResourceImages;component/Resources/lo开发者_如何转开发go.bmp and then I try to get the resource stream to that resource (using Application.GetResourceStream(myUri)) but it can't find the resource specified.

If however I put the image in the root directory of my dll and take out the Resources/ it can find and return the resource stream without issue.

Any suggestions?


to anyone else who might be having this particular issue, make sure that you build the string to pass into the new uri BEFORE you make the new call, not during. I changed it so that the pack: location string is all created ahead of time and now it works

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜