Hi everybody,
I create a project as library to make custom classes and functions, then I use this library reference to two Revit-Addin projects.
Because I want to install each project separately so each project should contain their own library assembly in their setup folder. In this way, I can easily manage every single project without caring about others.
I use method Assembly.GetExecutingAssembly() to check where the library.dll is referring to. When I first run the project 1, I get the correct assembly path - the project 1 folder. Then I run project 2 and get the unexpected result, the path is in the project 1 folder again. This should return project 2 folder as my expectation. The similar problem occur if i run the project 2 first.
In my knowledge, I guess after I run the project 1, the assembly path have save in computer memory. Then when I run the project 2, the code get the reference in computer memory and return unexpected result.
Is anyone here have had same problem? Can you give me solution? I would like to attach my Solution here for your information
Thank a lot!
P/s: Here are some screen shots
If you load an assembly A into the .NET framework from directory Da and then load another version of assembly A from a different location Db, the .NET framework will determine that A has already been loaded and reuse the existing instance from Da, ignoring your request to load a second instance from Db. There are ways to work around this, presumably, but I will not even try to dive into that. I suggest that you design your two add-ins so that they do not rely on the location of the assembly A that you load in any way. You can easily move your assembly location determination code out of A into the main two add-ins instead.