Determining the name of a file containing an add-in

Aug 26, 2008 at 1:00 AM

At runtime, when I'm activating an add-in, is there any way to determine the name of the file that contains the add-in's assembly?  I am retrieving the AddInToken.AssemblyName.Name, but this isn't quite the same thing - the assembly name appears to be compiled into the assembly, so if someone changes the name of the .DLL file after it's built, this doesn't return the same value.

I couldn't find a way to get the file name anywhere, but I'm hoping I just missed something.

Bob Wall

Aug 26, 2008 at 7:54 PM
Hi Bob,

Unfortunately there's currently no easy way to get the add-in's path. We're looking at including it for the next version.

Generally speaking, file names should be the same as the assembly name + ".dll". So you could use AddInToken.AssemblyName.Name. Yes, it will fail in the case where an assembly has been renamed, but there shouldn't be a reason to rename assemblies. Additionally, renaming assemblies can cause difficulties for the add-in framework and the loader in finding assemblies, so it's generally not recommended.