Wednesday, March 28, 2007

Codebase vs. Path Name - Different Casing on MS Platforms

While working on some code that loads assemblies I ran into an issue with Assembly.LoadFrom(pathName) in connection with the Assembly.CodeBase property. The method is supposed to load an assembly from the location given in the pathName parameter. When I pass as an example 'foo.dll' as a parameter, it loads the assembly and everything is fine. The interesting part starts, however, when I inspect the CodeBase property after the assembly has successfully loaded: Its value ends in "foo.DLL" (note the upper case file extension). This is certainly not a problem on a Microsoft platform, where file and folder names are case insensitive. If, however, you also intend to run your code on platforms where file names are case sensitive (e.g. Mono on Linux), then this behavior might be of interest to you as on those platforms "foo.DLL" and "foo.dll" are just two different files.

0 comments:

Post a Comment

All comments, questions and other feedback is much appreciated. Thank you!