The one method that can address this issue is to set the LogicalName
of the embedded resource. By default when you embed a resource, you will find an entry in your csproj file similar to
<EmbeddedResource Include="path to embdedded resource"/>
In the case of resources that are added using Add as Link
, you will find an additional Link
attribute. In this case, the Link
attribute is the path of the resource relative to your project structure and the Include
attribute is the pointing to file's location on your machine (relative to your project).
<EmbeddedResource Include="path to embdedded resource"/>
<Link>Libsx86My1st.dll</Link>
</EmbeddedResource>
In order to get the assemblies embedded using a different namespace the LogicalName
attribute can be added to the above which allows one to override the default msbuild behaviour.
<EmbeddedResource Include="path to embdedded resource"/>
<Link>Libsx86My1st.dll</Link>
<LogicalName>$(TargetName).Libs.x86.My1st.dll</LogicalName>
</EmbeddedResource>
The downside it would seem, is that one will need to do this for every resource added. I would however have preferred that this convention be set in some way such that this can be the default way to embed any resource in my project i.e. use the $(TargetName)
as a replacement for the default namespace
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…