|
|
|
start date: Wed, 1 Aug 2007 19:52:39 +0200,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
Alexander Widera
|
|
2
Peter Bucher [MVP]
|
|
3
Jesse Houwing
|
|
4
Jesse Houwing
|
resx in dll
Hi,
i am developing a website and a dll .... in the App_GlobalResources
directory are some .resx-files.... which filename i know.
I want to use them in a dll which is in the bin-directory?
how can i do that?
thanks,
alex
Date:Wed, 1 Aug 2007 19:52:39 +0200
Author:
|
Re: resx in dll
Hi Alexander
> i am developing a website and a dll .... in the App_GlobalResources
> directory are some .resx-files.... which filename i know.
> I want to use them in a dll which is in the bin-directory?
>
> how can i do that?
Mark "Build Action" in the Properties of the resx file to "Embedded
Resource".
You can seee a screenshoot of the propertie window here:
- http://aspnet.4guysfromrolla.com/articles/080906-1.aspx
--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
Date:Wed, 1 Aug 2007 21:38:07 +0200
Author:
|
Re: resx in dll
Hello Peter Bucher [MVP],
> Hi Alexander
>
>> i am developing a website and a dll .... in the App_GlobalResources
>> directory are some .resx-files.... which filename i know.
>> I want to use them in a dll which is in the bin-directory?
>> how can i do that?
>>
> Mark "Build Action" in the Properties of the resx file to "Embedded
> Resource".
> You can seee a screenshoot of the propertie window here:
> - http://aspnet.4guysfromrolla.com/articles/080906-1.aspx
I think what he's trying to do is to use the resources in the website project
in a project that is referenced by the website project.
So basically with a solution liek this:
+ solution
|- Project1
|- Website
|- References
| |- Project1
|- App_GlobalResources
|- Resource.Resx
And now he wants to access the resources in App_GlobalResources from sources
inside Project1.
The official word on this is that it cannot be done.
My guess is that using some creativity in the way you instantiate your resourcemanager
woudl actually get it to work, but I cannot guarantee that it will stay that
way.
The ResourceManager constructor get's an Assembly and a Resource name. For
the assembly try using Assebly.GetExecutingAssembly which with a bit of luck
resolves to the assembly in which the resource file was compiled. As name
for the resource... I'm not sure what the full name will be. You could try
using Lutz Roeder's Reflector to see how the compiler actually named it.
I'd guess something like 'WebSiteProjectsName.App_GlaobalResources.Resource.Resx.recource'.
From there you can use the GetString method of the Resource Manager to access
strings in the resource file.
A better solution would be to add a project to your solution which contains
the resources. Then use those resources from both the project and the website.
+ solution
|- ResourceProject
| |- Resource.Resx
|- Project1
| |- References
| | |- ResourceProject
|- Website
|- References
| |- Project1
| |- ResourceProject
|- App_GlobalResources
Jesse
Date:Wed, 1 Aug 2007 20:28:08 +0000 (UTC)
Author:
|
Re: resx in dll
Hello Peter Bucher [MVP],
> Hi Alexander
>
>> i am developing a website and a dll .... in the App_GlobalResources
>> directory are some .resx-files.... which filename i know.
>> I want to use them in a dll which is in the bin-directory?
>> how can i do that?
>>
> Mark "Build Action" in the Properties of the resx file to "Embedded
> Resource".
> You can seee a screenshoot of the propertie window here:
> - http://aspnet.4guysfromrolla.com/articles/080906-1.aspx
I think what he's trying to do is to use the resources in the website project
in a project that is referenced by the website project.
So basically with a solution like this:
+ solution
|- Project1
|- Website
|- References
| |- Project1
|- App_GlobalResources
|- Resource.Resx
And now he wants to access the resources in App_GlobalResources from sources
inside Project1.
The official word on this is that it cannot be done.
My guess is that using some creativity in the way you instantiate your resourcemanager
woudl actually get it to work, but I cannot guarantee that it will stay that
way.
The ResourceManager constructor get's an Assembly and a Resource name. For
the assembly try using Assebly.GetExecutingAssembly which with a bit of luck
resolves to the assembly in which the resource file was compiled. As name
for the resource... I'm not sure what the full name will be. You could try
using Lutz Roeder's Reflector to see how the compiler actually named it.
I'd guess something like 'WebSiteProjectsName.App_GlaobalResources.Resource.Resx.recource'.
From there you can use the GetString method of the Resource Manager to access
strings in the resource file.
A better solution would be to add a project to your solution which contains
the resources. Then use those resources from both the project and the website.
+ solution
|- ResourceProject
| |- Resource.Resx
|- Project1
| |- References
| | |- ResourceProject
|- Website
|- References
| |- Project1
| |- ResourceProject
|- App_GlobalResources
Jesse
Date:Wed, 1 Aug 2007 20:38:14 +0000 (UTC)
Author:
|
|
|