views:

114

answers:

2

ASP.NET application w/CSLA framework; Visual Studio 2008

I have a class library of business objects. I am storing the broken rules strings in the Resource file associated with the project (My Projects > Resources.resx). I added a new resx file to the project and named it Resources.fr-CA.resx to store the french language equivalents of the rules.

I am calling the strings with the My.Resources object, like this:

e.description = My.Resources.BrokenRulesString

This works like a charm when I run the application locally (i.e. hit "play" in Visual Studio). However, when I build and deploy the application to another environment I always get the values in the default resource file.

Even if I explicitly set the culture to "fr-CA" in the Resources.Designer.vb file, like this, the property returns the string from the default resource file:

Public ReadOnly Property BrokenRulesString() As String
   Get
        Return ResourceManager.GetString("BrokenRulesString", "fr-CA")
   End Get
End Property

It looks to me like the application can't see the fr-CA resource file so defaults to the... default file. Any tips to get this working?

Thank you.

+1  A: 

You need to make sure the satellite assembly containing your localized strings is deployed in the correct directory structure. See this MSDN article for details.

From the article:

After you have compiled your satellite assemblies, they all have the same name. The runtime differentiates between them based upon the culture specified at compile time with Al.exe's /culture option and by each assembly's directory location. You must place your satellite assemblies in expected directory locations.

Oded
Thanks for the tip.I used Al.exe to create MyApp.Business.Library.resources.dll and placed it in the C:\Inetpub\wwwroot\MyApp\bin\fr-CA folder of the deployed application. However, I am still only getting the default (english) resource file.Can you think of a detail I might be missing?
Now that I've been looking in this direction, I see that MyApp.Business.Library.resources.dll was being created the whole time, located in the bin/fr-CA folder of the class library in question.So my problem is not with creating the dll but with having it deployed as part of the MSI package. Can you suggest anything in this regard?Thank you.
A: 

Ultimately it came down to the fact that I hadn't added the proper Project Output Group (Localized resources) for the Business.Library project to the setup project. I added it to the bin folder and now the deployed application works like a charm as well.

Oded, thanks for getting my head pointed in the right direction. Cheers!