One of the biggest difference in Win32 and .Net is probing. In Win32 (and *nix), OS loader looks for binaries in directories specified in %PATH% environment variable. In .Net, we probes GAC, and app base. That is it. We do not honor %PATH% environment variable.
The reason for this rather radical change, is that probing rule is well defined. In the Win32 world, you really don't have any idea what will be loaded. If another application changes the %PATH% environment variable, you can only pray that it does not add a library that you need. In .Net world, installation of another application won't affect your application, unless it really plays dirty by putting bits in your directory. (Publisher policy is an exception, it is by design affecting whole machine, for shared components).
And the way to share component, is to strongly name your assembly, and install it to GAC.
This shift obviously causes a lot confusion when people move from Win32 to .Net.
So I received this email:
Subject: Locating Assemblies
I have 4-5 managed assemblies. I am using those in my test cases.
Now if I have the assemblies in the same directory as my test case .exe then all is good.
But I cannot do that since these assemblies are used by many test cases.
I cannot GAC the assemblies since they are not strong named. Also I do not want to GAC them.
Another alternative is to have application config file that points to the location of these assemblies but it does not make sense to have a config file for each application since I will have lots of test cases.
My question is : how could I tell the .exe from where to locate the assemblies that it needs? Is there any environment variable I can set or any machine level setting, that will make it probe for assemblies in the specified location.
Sorry, there is no magic environment variable. To share your assembly, you have to strong name your assembly, and put it in GAC. This is THE way to share.
Are you from Win32 world? What is your transition story?