第二个嵌入资源不会添加到主 DLL 中,而是添加到新语言特定的 DLL 中
我有一个 dll,其中已经嵌入了一段时间的资源,称为 cert1.p12。它出现在 Reflector 的资源下,我可以毫无问题地从代码访问它。但是现在我添加了一个名为 cert2.pem 的新嵌入式资源,我已将其标记为嵌入式资源,这显示在 .csproj 文件中。但是,当我编译时,它不会出现在 Reflector 中,并且我无法从代码中访问它。
但是现在有一个特定于语言的资源文件,其中包含 cert2 资源。
我在编译器输出中注意到一件事:
Csc.exe 包含一行 /resource:Provided\cert1.p12,BookingClient.Provided.cert.p12 ,但没有提及新资源。
还有一个 AL.exe 行,其中包含 /embed:Provided\cert2.pem,BookingClient.Provided.cert2.pem
文件之间的一个区别是,一个是二进制文件,一个是文本文件。
编译器是否以某种方式以不同的方式对待这两个资源?我如何告诉编译器,即使文件是文本,它也不是语言资源,应该放在主 DLL 中。我什至不需要特定于语言的资源 dll。
多谢。
I have a dll that has had an embedded resource in it for a while, called cert1.p12. It appears in Reflector under resources, and I can access it from code with no problems. However now I have added a new embedded resource called cert2.pem, I have marked it as embedded resource, and this is shown in the .csproj file. However when I compile, it does not appear in Reflector and I cannot access it from code.
However now there is a language specific resource file with the cert2 resource in it.
One thing I did notice in the compiler output:
The Csc.exe contained a line with /resource:Provided\cert1.p12,BookingClient.Provided.cert.p12 on it, but no mention of the new resource.
There was also an AL.exe line with /embed:Provided\cert2.pem,BookingClient.Provided.cert2.pem
One difference between the files one is binary and one is text.
Is the compiler somehow treating these two resources differently? How can I tell the compiler that even though the file is text, it is not a language resource and should go in the main DLL. I don't even need a language specific resource dll.
Thanks a lot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊啊解决了。我没有将文件标记为嵌入资源,而是使用属性添加了一个资源文件,并将两者添加为文件,现在我也不需要自己将流转换为数组,我只需直接从全局 Resources 对象访问该数组。
我实际上认为资源文件适用于您确实需要单独的语言文件的情况,但在这种情况下它是理想的,并且所有内容都在主 dll 中,正如我想要的那样。
Ahh sorted it out. Instead of marking files as embedded resources, I added a resource file using the properties, and added both as files, now I don't need to convert a stream to an array myself either, I just access the array directly from the global Resources object.
I actually thought resource files were for when you do want a separate language file, but it is ideal in this case, and everything is in the main dll as I wanted.