Home All Groups Group Topic Archive Search About

Embedded resource namespace

Author
27 Jun 2005 4:00 PM
Jason Pettys
In an ASP.NET project I am setting the content type of my .ascx and
..aspx files to Embedded Resource for a separate reason.  When I do this
they get embedded as "RootNamespace.Filename" but I would like them to
be embedded as "RootNamespace.Folder.Filename".

I see that the .resources files are embedded with the containing folder
information in the namespace, and I think c# projects work this way,
too.  Is there any way (a vbc command option maybe?) to get what I'm
looking for?

Thanks,

Jason
www.pettysconsulting.com

Author
28 Jun 2005 6:13 AM
Peter Huang" [MSFT]
Hi

Which version VS.NET  are you using, 2003 or 2005?
Based on my test, even if we create a folder named TestFolder, and put the
aspx page into the folder, after compilation, the namespace is still
Rootnamespace.filename.
I think the namespace is the logical organization, but the folder is just
the physical organization. Even we put two file with different namespace in
one folder, the namespace will not change.

I think in the project properties, we can set the Rootnamespace property,
so that we can change that to make the final namespace looks like
Root.TestFolder.filename.

If I have any misunderstanding, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Author
28 Jun 2005 1:39 PM
Jason Pettys
Thank you for your response!  I'm using VS.NET 2003.

I'll have to explain a little better.

In a c# project the namespace of embedded resources follows the folder
structure, but in a vb.net project it does not.

Example:
    root namespace=Root
    resource is "File.bmp" located in project folder "Div"
    In c#, the resource name will be Root.Div.File.bmp,
    but in vb it will be Root.File.bmp.

This is a problem if you have two folders in your project, both with a
File.bmp; in c# they will be distinguished by namespace, but in vb
you'll get a compilation error.

To make things more interesting, the .resource files that are embedded
in vb projects DO have namespaces that follow the folder path.

It would be interesting to know the story behind this behavior, but what
would be most helpful to me is a way to specify a namespace for embedded
resources, or to set an option so that the namespaces follows the folder
path like in c# projects.

Your suggestion to change the Rootnamespace would change the namespace
of the embedded resource, but still does not allow files of the same
name in different folders to be embedded in a vb project, while they can
be in a c# project.

Hope this clarifies things.  As I think about the problem I think I
could probably switch to building with NAnt to solve this, but I'd
rather not go that far for this change.

Thanks!

Jason



Peter Huang [MSFT] wrote:
Show quoteHide quote
> Hi
>
> Which version VS.NET  are you using, 2003 or 2005?
> Based on my test, even if we create a folder named TestFolder, and put the
> aspx page into the folder, after compilation, the namespace is still
> Rootnamespace.filename.
> I think the namespace is the logical organization, but the folder is just
> the physical organization. Even we put two file with different namespace in
> one folder, the namespace will not change.
>
> I think in the project properties, we can set the Rootnamespace property,
> so that we can change that to make the final namespace looks like
> Root.TestFolder.filename.
>
> If I have any misunderstanding, please feel free to post here.
>
> Best regards,
>
> Peter Huang
> Microsoft Online Partner Support
>
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
Author
29 Jun 2005 9:58 AM
Peter Huang" [MSFT]
Hi

I understanding your concern, and now I am researching the issue, I will
update you with new information ASAP.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Author
1 Jul 2005 5:46 AM
Peter Huang" [MSFT]
Hi

Based on my research, I think it is the feature of C#.
I think you may contact MSWISH program to submit your idea.
How to Contact the Microsoft Wish Program
http://support.microsoft.com/default.aspx?scid=kb;en-us;114491

You may try to use use the Email or Phone approach.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.