Home All Groups Group Topic Archive Search About

Embedded Resource Name Specification

Author
18 Oct 2006 7:24 PM
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

Author
19 Oct 2006 2:51 AM
Bryan Phillips
Bryan Phillips
MCSD, MCDBA, MCSE
Blog:  http://bphillips76.spaces.live.com



Show quote
"Chris  Moore" <CMo***@gmail.com> wrote in message
news:1161199481.452315.33680@k70g2000cwa.googlegroups.com:

> 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
Author
19 Oct 2006 2:52 AM
Bryan Phillips
The file name does not matter.  You can manually edit the project file
with notepad if you need to.

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




Show quote
"Chris  Moore" <CMo***@gmail.com> wrote in message
news:1161199481.452315.33680@k70g2000cwa.googlegroups.com:

> 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
Author
19 Oct 2006 1:46 PM
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

Bryan Phillips wrote:
Show quote
> The file name does not matter.  You can manually edit the project file
> with notepad if you need to.
>
> Bryan Phillips
> MCSD, MCDBA, MCSE
> Blog:  http://bphillips76.spaces.live.com
>
>
>
>
> "Chris  Moore" <CMo***@gmail.com> wrote in message
> news:1161199481.452315.33680@k70g2000cwa.googlegroups.com:
>
> > 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
Author
26 Oct 2006 2:24 AM
Bryan Phillips
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




Show quote
"Chris  Moore" <CMo***@gmail.com> wrote in message
news:1161265578.885041.89760@i3g2000cwc.googlegroups.com:

> 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
>
> Bryan Phillips wrote:
>
> > The file name does not matter.  You can manually edit the project file
> > with notepad if you need to.
> >
> > Bryan Phillips
> > MCSD, MCDBA, MCSE
> > Blog:  http://bphillips76.spaces.live.com
> >
> >
> >
> >
> > "Chris  Moore" <CMo***@gmail.com> wrote in message
> > news:1161199481.452315.33680@k70g2000cwa.googlegroups.com:
> >
>
> > > 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

AddThis Social Bookmark Button