How can I embed C# assembly resources in the same assembly?

我怕爱的太早我们不能终老 提交于 2020-01-13 18:19:08

问题


I have added resources for different cultures to my Class Library Project. When building, seperate folders are created for each culture with an assembly in each of them.

Is there a way to embed all the resources in the Class Library Assembly, instead of having an extra assembly for each culture? The class library is eventually used in another project, so with theses seperate folders, it need to distribute a zip file instead of just one assembly.

Clarification: I was looking for a solution without installers or second party tools. Rather was I hoping for a solution inside Visual Studio where the outcome would be one assembly with the different resources in it.


回答1:


To murge multiple assemblys into one you can use Fody/Costura. It allows you to merge multiple assemblys into 1 project. In your main project you add it(can be done via nuget). Then just in weavers.xml (file that will be automaticly generated add these text:

<Costura>
    <IncludeAssemblies>
        Project.MyData.Dutch
        Project.MyData.French
        Project.MyData.English
    </IncludeAssemblies>
</Costura>

(it should be the same name as the reference, so without the .dll suffix)



来源:https://stackoverflow.com/questions/22663001/how-can-i-embed-c-sharp-assembly-resources-in-the-same-assembly

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!