In debugging some behavior that relies on knowing the current executing assembly's path, I note that if I execute the following line in a C# VS 2010 project with no adjustments made to the build output path, the Assembly.GetExecutingAssembly is returning a case-correct path.
e.g.,
string location = Assembly.GetExecutingAssembly().Location;
shows "C:\src\MyProject\MyProject\bin\Debug\MyProject.exe"
Now, if I create a separate directory to output the assembly to, such as: C:\src\MyCamelCaseDir\, and update the Build -> Output path to C:\src\mycamelcasedir, the code above produces the string "C:\src\mycamcelcasedir\MyProject.exe".
The distinction being, clearly
"..\\MyCamelCaseDir".equals("..\\mycamelcasedir")
is false, even if the OS doesn't treat paths as case-sensitive.
I assume that running in debug mode in Visual Studio is the reason for this... but I'm still a little confused - shouldn't GetExecutingAssembly return the directory path the operating system thinks contains the assembly, case and all?
EDIT: I don't think my question was well phrased. The correct answer to my question is the poster who notes that VS is just concatenating the text box in Build Ouput Path plus project name.
The question I was trying to ask was: why doesn't Assembly.GetExecutingAssembly().Location, return the path with case sensitivity the way the operating system is storing it?
I know that Windows is case insensitive in that you can type C:\foo\bar into an explorer window, and that will take you to C:\Foo\Bar (if there is such a directory).
But I would have thought that the location of the executing assembly would be the same in all cases, debug or not.