Addin doesn't work on another PC

filip_tacic
Participant
Participant

Addin doesn't work on another PC

filip_tacic
Participant
Participant

Hi,

 

I created a simple add-in that adds hangers (a custom family I created prior to coding the app) along the duct curve. The problem occurs when I run the add-in via my office PC.

 

Here's some information:

1. Add-in is coded in visual studio (C#) - and everything works fine on my personal PC.

 

2. After building the add-in, I copied the manifest file (*.addin) and the .DLL file to the %appdata% location on my office PC. When I run Revit it asks me to load the add-in, and the push button appears on the ribbon. So far so good.

 

3. When I activate the command on the ribbon, it shows me Dialog saying that the required family is missing. I did this on purpose, just to check if the external application can be started. The result is yes, it starts with no problem.

FilteredElementCollector collector = new FilteredElementCollector(doc);
                    IList<Element> symbols = collector.OfCategory(BuiltInCategory.OST_MechanicalEquipment).WhereElementIsElementType().ToElements();                             

                    //Pravim praznu promenljivu tipa Element u koju planiram da smestim familiju "Hanger - SU", koja ce mi trebati za dalju obradu
                    Element hangerFamily;                      
                    hangerFamily = symbols.Where(elem => elem.Name == "Hanger - SU").FirstOrDefault();

                    //Kreiram Family Symbol objekat od Elementa - OVO JE INSTANCA od familije koju smo izabrali
                    FamilySymbol famsym = hangerFamily as FamilySymbol;
                    

                    //Provera da li je familija pronadjena, ako nije izbacuje gresku, a ako jeste kreci glavni program
                    if (famsym == null)
                    {
                        TaskDialog.Show("Greska", "Familija 'Hanger - SU' nije ucitana. Ubacite familiju u projekat pa pokrenite opet komandu");
                    }

 

4. After that, I loaded the required family in the project and clicked the push button again. And here the issue appears, saying "Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index". To me, it just looks like some loop is not iterating properly - But how can it be, when everything works just fine on my personal PC where I coded and tested the app with no issues?

 

5. I checked the installed .NET frameworks on both PCs, and the version on my personal PC is 4.8.9032.0, while my office PC .NET version is 4.8.3752.0.

 

Does anyone have any idea what might be causing the issue?

 

 

0 Likes
Reply
Accepted solutions (1)
413 Views
2 Replies
Replies (2)

mhannonQ65N2
Advocate
Advocate
Accepted solution

It sounds like the error is in part of the code you didn't share, since it is finding the family symbol. Also, are you testing it on the same project and with the same input?

filip_tacic
Participant
Participant

Hi Mhannon,

 

Thank you for your answer! I double-checked both projects and they were fine, but it turned out that the hanger family on my local PC had an extra reference plane (which I used inside the add-in code), and the hanger family in my office was a previous version of the same family (without the ref plane).

 

Now, everything works perfectly!

 

PS. In the first post, I've attached the complete VS solution with all the classes and codes.

 

Thanks once again, you really helped me out!

Filip

 

 

 

0 Likes