我如何将.jpg包含到dll中?

问题描述 投票:2回答:1

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

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

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

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

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

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

c# visual-studio dll resources export
1个回答
2
投票

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

enter image description here

((EDIT)Visual Studio Code变体

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

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

来源:

  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?;
© www.soinside.com 2019 - 2024. All rights reserved.