I've been looking around but I have not found a solution for this problem: I want to create a class library that has a configuration file under a sub-directory called Configuration. I want that class library to be deployed anywhere and I want it to find its configuration files by knowing its own location.
Previous attempts with Assembly.GetExecutingAssembly().Location
did not work.
It would return temp locations such as
C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\7c00e0a3\38789d63\assembly\dl3\9c0a23ff\18fb5feb_6ac3c901
instead of the desired
bin/Configuration
path.
So:
This should work -
string assemblyFile = (
new System.Uri(Assembly.GetExecutingAssembly().CodeBase)
).AbsolutePath;