How To: Change the name of embedded .resources

Another interesting question came across the internal Visual Studio conversion mailing list yesterday:

Say I have assembly foo.dll, and in .csproj file I have

    <EmbeddedResource Include="bar.resx" />

Then, bar.resx will be built into in foo.dll. However, say I want What’s the best way to do it?

The answer, it turns out, is a neat example of how MSBuild supports metadata on individual items. The metadata on an item travels with it through the build process, and tasks can use that metadata as necessary. In this case, the task that generates the resource is GenerateResourceTask, and it knows about the <LogicalName> metadata. Use the element like this:

    <EmbeddedResource Include="bar.resx">

This will cause bar.resx to get generated into the file. For more details, check out the article on our wiki about GenerateResourceTask.

[ Author: Neil Enns ]

Comments (0)

Skip to main content