Reputation:
I'm installing two instances of my Revit addin. When I run Revit everything is shown correctly in the ribbon panel: two dropdowns - one for each instance. The problem is that both access the same dll file (the one that is loaded first) even though each path of each addin file leads to a different location.
This is how the addin files look like:
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Application">
<Assembly>C:\A\My.Application.dll</Assembly>
<ClientId>{GUID1}</ClientId>
<Name>My Plugin A</Name>
<FullClassName>My.Application.Application</FullClassName>
</AddIn>
</RevitAddIns>
and
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Application">
<Assembly>C:\B\My.Application.dll</Assembly>
<ClientId>{GUID2}</ClientId>
<Name>My Plugin B</Name>
<FullClassName>My.Application.Application</FullClassName>
</AddIn>
</RevitAddIns>
I've changed every entry but couldn't get Revit to load two different files.
Any ideas or hints are much appreciated.
Upvotes: 1
Views: 1971
Reputation: 8574
The .NET AppDomain will not load the same class twice. And Revit uses this mechanism.
For you case, I would suggest edit the AssemblyInfo.cs file. First I would suggest you use a different name for each assembly you build (with different versions of your reference). If you must maintain the same name, you can consider different versions so .NET AppDomain loads both. Below are the attributes you should consider change:
[assembly: AssemblyTitle("Name01")]
[assembly: AssemblyProduct("Name01")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: AssemblyInformationalVersion("1.0.1")]
To maintain the same code, you can use C# Preprocessor Directives and compile both cases (creating both DLLs during build).
Upvotes: 2