如何将.jpg包含到dll中? [英] How do I include a .jpg into a dll?

查看:188
本文介绍了如何将.jpg包含到dll中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个第三方应用程序,可以通过.cs代码创建一个dll文件。

I have a third-party application that creates a dll file out my .cs code.

在我的.cs代码中,我引用了一个文件。

In my .cs code I reference a file.

我如何编译dll或.cs使其包含.jpg文件以及代码?

How do I compile the dll or .cs to include the .jpg file along with the code?

我为第三方应用程序提供的选项不允许我导出.jpg

The options I have for the third-party application does not allow me to export the .jpg

导入过程仅查看.cs和关联的.dll。

The import process only looks at the .cs and the associated .dll.

一旦第三方应用程序在导出过程中使用可视化的stuido或其他东西创建了dll,是否可以将文件添加到dll中?

Is there a way to add the file to the dll once the third-party application has created the dll in the export process with visual stuido or something?

推荐答案

是的,这是可能的。如果文件被dll中的代码使用,则需要通过属性>>构建操作>>嵌入资源设置将文件嵌入文件中。

Yes this is possible. If the file is used by your code in the dll then the file needs to be embedded thorugh the Properties >> Build Action >> Embedded Resource setting:

您必须编辑.csproj并将代表您文件的节点更改为:

You have to edit the .csproj and change the node that represents your file to:

<EmbeddedResource Include="Resources\yourEmbeddedResource.json" />



来源:



Source:


  1. https://starbeamrainbowlabs.com/blog /article.php?article=posts/180-Embedding-Resources.html ;

  2. https://www.codeproject.com/Articles/114997/Embedding-and-Using-Resources-from-Net-Assembly ;

  3. 如何在Visual Studio Code中将文件标记为嵌入式资源?;

  1. https://starbeamrainbowlabs.com/blog/article.php?article=posts/180-Embedding-Resources.html;
  2. https://www.codeproject.com/Articles/114997/Embedding-and-Using-Resources-from-Net-Assembly;
  3. How to mark a file as an embedded resource in Visual Studio Code?;

这篇关于如何将.jpg包含到dll中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆