Pergunta

Hi I have a solution which I just migrated from .Net 3.5/MVC1/VS2008 to .Net 4.5/MVC4/VS2012

Most of the things work well but I have a string resource file problem

My solution has 3 projects one of which is the core and the other ones are dependent on the core.

In each of the projects I have a strings file named in the following pattern:

Core Project - file name is Strings.resx

Dependency1 project - file name is Dependency1Strings.resx

Dependency2 project - file name is Dependency2Strings.resx

Each of those files have strings pertaining to the particular project.

When the solution loads I create one ResourceManager for each project using the following code(example uses Dependency2):

ResourceManager manager = new ResourceManager("Dependency2.Dependency2Strings", typeof(Dependency2Strings).Assembly);

Later when I try to call manager.GetString(messageName,ClientCulture)

I get a FileNotFoundException stating that the file Dependency2.resources.dll can not be located.

The strange thing is that the PublicToken that it lists for the Dependency2.resources.dll is the same as the PublicKey for the Dependency2.dll.

My question is does anyone know why and where the Dependency2.resources.dll should be generated(maybe it's a new setting). In previous versions of .Net this code worked with no problem.

This only happens for the Dependency projects, not for the Core one. It almost looks like .Net is confusing this project structure with a Satelite Assembly structure.

Foi útil?

Solução

So after a lot of try and error I came a round with a compromise solution.

I placed all the resource strings into the same resx file and then had all 3 resourcemanagers reference the same file.

This worked!

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top