views:

26

answers:

2

Hi,
We are migrating a .Net windows application to Windows 7. This application can be used in multiple languages, but only English is installed by default. There is a menu item that allows users to download additional languages.
This application is using the standard .Net satellite resources folder organization: http://msdn.microsoft.com/en-us/library/sb6a8618%28v=VS.80%29.aspx.
The problem in Windows 7 is that the users are not administrators and don't have write access to the "program files" folder where the application is installed. This means that when the users try to download a new language resources file they get an error.
Is there a way to direct .Net to look for resources files in another folder, for example one inside the user's home directory? I know you can add the resources to .Net Global assembly cache, but you also need administrator rights for that.

Edit: I'm aware of the <probing> configuration parameter ( http://msdn.microsoft.com/en-us/library/823z9h8w.aspx), but it can be used only to specify a subdirectory of the application's base path. Is there a way to force it to a folder outside of the application's home?

Edit: I think I could probably use the AppDomain.AssemblyResolve event to look for the appropiate resources, but it won't be called for resource assemblies prior to .Net 4 and I can't have the users update to that version yet.

Thanks,
Guillermo

A: 

VB.Net has a SpecialDirectories class that can be used to access directories such as the current user application data directory (via the CurrentUserApplicationData member).

You can write to this directory without admin privileges, though I would make sure to create a unique directory structure within it for your application.

Oded
Yes, I have no problem writing to the user directory. What I'm looking for is a way to control the .Net probing for other languages resource files.
Guillermo Vasconcelos
@Guillermo - sorry, I don't know of any way of avoiding the application path or gac :(
Oded
A: 

I finally managed to make it work creating a junction folder link from a subdirectory (user) under the application folder to a directory in the user's folder. Then I added the following line in app.config under the assemblyBinding tag:

<probing privatePath=".;user" />

The application writes the resource files in the user's folder and they are accessed by the application as if they were in the correct path.
It is not the most elegant solution but it it working.

Guillermo Vasconcelos