I'm writing an Excel plugin using ExcelDna. I want to locate the directory the assembly was installed in so that I can open files from that directory. I have successfully used this approach in the past, but it does not work after upgrading to .NET Framework 4.7.1. I'm trying to figure out why.
Here's what is currently in my plugin:
var codePath = Assembly.GetExecutingAssembly().CodeBase;
When I hover over it in the debugger, it gives the right path. After I execute the statement codePath
has the location of mscorlib (and hovering over it with the debugger still has the right location). I've also tried variants using typeof(<typeWithNoIneritance>).Assembly.CodeBase
and using Location
instead of CodeBase
.
What should I be looking at next?
Aucun commentaire:
Enregistrer un commentaire