问题
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