问题
I have a third-party application that creates a dll file out my .cs code.
In my .cs code I reference a file.
How do I compile the dll or .cs to include the .jpg file along with the code?
The options I have for the third-party application does not allow me to export the .jpg
The import process only looks at the .cs and the associated .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?
回答1:
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:
(EDIT) Visual Studio Code variant
You have to edit the .csproj and change the node that represents your file to:
<EmbeddedResource Include="Resources\yourEmbeddedResource.json" />
Source:
- https://starbeamrainbowlabs.com/blog/article.php?article=posts/180-Embedding-Resources.html;
- https://www.codeproject.com/Articles/114997/Embedding-and-Using-Resources-from-Net-Assembly;
- How to mark a file as an embedded resource in Visual Studio Code?;
来源:https://stackoverflow.com/questions/61805604/how-do-i-include-a-jpg-into-a-dll