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
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:
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.