View previous topic :: View next topic |
Author |
Message |
jmaeding
Joined: 11 Apr 2008 Posts: 67
|
Posted: Wed Jan 14, 2015 4:47 pm Post subject: assembly attribute prevents placing inherited VT on form |
|
|
I created a class that inherits VT, and went to place it on my form and it gave an error:
Failed to create component "MyVT".
...could not load assembly "accore.mgd".....
I have made many VT controls before and never had this issue.
I narrowed it down to the fact that my form is part of an assembly marked as:
[assembly: CommandClass(typeof(CTCivilXtra.XAppAcad))]
[assembly: ExtensionApplication(typeof(CTCivilXtra.XAppAcad))]
These attribute definitions come from Autodesk.AutoCad.Runtime, which involves the accore.mgd.dll and a couple others.
I use these as you have to when making classes that define commands for AutoCad. If I take them away, the MyVT adds to the form no problem.
Those acad assemblies do exist on my computer in my autocad installation folder. They do not get copied local, Copy Local is false for them, so maybe that is why they are not found.
I do not have the VT source code, not sure if its even sold, so do not know why the inherited VT does this.
A non-inherited VT placed straight from toolbox does add fine.
Not sure why this happens but I can replicate on a very simple project if needed.
[/img] _________________ James M |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Jan 15, 2015 12:25 am Post subject: |
|
|
I think the problem is that the visual studio designer needs to load your assembly in order to put the control on your form - however it can't find some of the assemblies that your assembly depends on (because of those attribute definitions). You could try either ensuring the required assemblies are copied to the same directory as the assembly containing the derived virtual tree, or you could register the required assemblies in the Global Assembly Cache (GAC) using Gacutil.exe. _________________ Infralution Support |
|
Back to top |
|
|
jmaeding
Joined: 11 Apr 2008 Posts: 67
|
Posted: Thu Jan 15, 2015 1:37 am Post subject: |
|
|
neither of those ideas will work for AutoCad add-ons.
It sounds like you think this is a generic issue though, like any component would do this.
Its only ones that derive from VT though, as if there is reflection going on and freaking out.
The source code would reveal this I think. _________________ James M |
|
Back to top |
|
|
jmaeding
Joined: 11 Apr 2008 Posts: 67
|
Posted: Thu Jan 15, 2015 1:41 am Post subject: |
|
|
source code is only $200. I wasted that already, just did not notice it before. _________________ James M |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Jan 15, 2015 2:23 am Post subject: |
|
|
Does the problem only happen at design time - ie if you programmatically create an instance of VirtualTree and add it to your forms Controls collection does this cause an error when you use the add on? _________________ Infralution Support |
|
Back to top |
|
|
jmaeding
Joined: 11 Apr 2008 Posts: 67
|
Posted: Thu Jan 15, 2015 2:40 am Post subject: |
|
|
have not tried. I also need to try uncommenting the attributes once the control has been added design time. _________________ James M |
|
Back to top |
|
|
jmaeding
Joined: 11 Apr 2008 Posts: 67
|
Posted: Mon Jan 19, 2015 5:18 pm Post subject: |
|
|
I was able to uncomment the attributes after adding the inherited VT to my form.
This may come in handy for others writing AutoCad Add-ons, for which the VT is just the best control ever.
Things like Layer lists and data exploration would not be the same without it! I would like to make one of the examples be an autocad layer list, to get that crowd interested. _________________ James M |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Jan 19, 2015 9:49 pm Post subject: |
|
|
Great. If you want to provide us with a sample AutoCAD AddOn using Virtual Tree we would be happy to put the code up on our site. _________________ Infralution Support |
|
Back to top |
|
|
|