Embedded Resource Name Specification

  • Thread starter Thread starter Chris Moore
  • Start date Start date
C

Chris Moore

SUMMARY: I want to override the default embedded resource naming
convention and excercise complete control over the name of an embedded
resource within an assembly.

DETAIL: For non-dependent files, visual studio names a resource
according to the convention <default
namespace>.<FolderName>.<FileName>. How can some other name for a given

resource be specified? I am willing to manually modify the project file

if necessary.


Thank You,
Chris Moore
 
Bryan,

Thanks for your response; however, I'm not sure we're on the same page
here. Let me try to present my problem more clearly:

Visual Studio/MSBuild uses a "dependency" scheme that can associate a
resource file with a given class. This mechanism is used, for instance,
to bind RESX files with their associated forms. Among other things,
this allows the environment to display the dependent resource files as
child nodes of the associated form classes. For example, to associate
the resource "Person.xml" resource with the file "Person.cs" one would
configure the MBBuild file thusly:

<Compile Include="Person.cs"/>
<EmbeddedResource Include="Person.xml">
<DependentUpon>Person.cs</DependentUpon>
</EmbeddedResource>


The compiler will embed the mapping resource with the name of the type
with which it is associated "Person" instead of the full name of the
file "Person.xml".

Is there a way to override this convention so that, for example, the
compiler will embed the Person.xml resource with the name "Person.xml"
instead of just "Person"?

Thanks,

Chris Moore
 
When I set files to Embedded Resource in a project, both the filename
and file extension are used for the name. I figure that since your
related file is a class that that is what is causing the naming
difference. You could write a small console app to fix the embedded
name and configure the project to execute the app post-build. I have
done that a few times when I needed to modify attributes or IL code
after the build.

Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
 
Back
Top