AddInStore.FindAddIns unable to find addins

Feb 25, 2008 at 7:21 PM
I created a contract assembly, a host, and addins and used the latest PipelineBuilder to complete the pipeline.
My code has been unsuccessful in finding any of my addins. The return from the AddInStor.FindAddIns is 0 tokens
Having worked with this quite awhile I decided to take one of your samples that appeared to use the PipelineBuilder and test it.
I used the Event Sample and it ran fine as it was packaged. I then deleted the AddInSideAdapters, AddInView, HostSideAdapters, HostView and output directories then executed the PipelineBuilder AddIn against the Samples.Events.Contracts. After the PipelineBuilder completed a reference to Hostview was added to Sample Host and a reference to AddInView was added to SimpleCountingAddIn.
The Solution Build was successful but now the return from line 19 of Sample_Host.Program.cs is 0 tokens just like my code.
Line 19: IList<AddInToken> tokens = AddInStore.FindAddIns(typeof(IAddIn), PipelineStoreLocation.ApplicationBase);
This eventually causes and UnHandled ArgumentOutOfRange at line 24: IAddIn addin = addins0;
I also attempted to modify the WPF Calculator example to use the PilelineBuilder but had too many issues to resolve.
More full examples using the PipelineBuilder would be helpful. Converting the existing to work with the lastest PipelineBuilder would be very beneficial.
I have been unable to understand this problem and am looking for a bit of help.
Feb 25, 2008 at 7:45 PM
I just noticed the original build for Event Sample has Runtime Version:2.0.50727.1434 in the generated files and those that I created have a Runtime Version:2.0.50727.1433.
Feb 25, 2008 at 9:00 PM
I noticed when the output directory from the original Event Sample is built during the Solution Build, the ../output/addins/SimpleAddIns/ subdirectory only contains the addins of the project. After deleting the AddInSideAdapters, AddInView, HostSideAdapters, HostView and output directories, then executing the PipelineBuilder AddIn against the Samples.Events.Contracts, then when the output directories are built after the Solution Build, the ../output/addins/SimpleAddIns/ subdirectory now contains a copy of the AddInView.dll and AddInView.pdb. The program fails to find the addin when these files are present but once they are removed the addin will be found and processing will complete normally.
Feb 25, 2008 at 9:03 PM
The most likely cause of these problems is the lack of the "AddInContract" attribute on the contract type representing the add-in. This attribute needs to be present for AddInStore.Update to be able to catalog add-ins for use in AddStore.FindAddIns.

One other thing to check is the warnings lists that comes back from AddInStore.Update/Rebuild. It will give you some hints as to what went wrong.

Feb 26, 2008 at 3:34 PM
My project and your Event Sample both have the "AddInContract" attribute on the contract type representing the add-in. The location of the AddInView.dll with the addins appears to be causing the problem, once it is removed the addins are found. I will modify the code to get the warnings from the AddInStore.Update/Rebuild and see what happens.

Feb 26, 2008 at 3:39 PM
Edited Feb 26, 2008 at 3:44 PM
Here is the message returned from Event Sample:
"The assembly \"C:\\Documents and Settings\\mtillman\\My Documents\\Visual Studio 2008\\Projects\\Event Sample\\output\\AddIns\\SimpleAddIn\\AddInView.dll\" should not be in location \"C:\\Documents and Settings\\mtillman\\My Documents\\Visual Studio 2008\\Projects\\Event Sample\\output\\AddIns\". Remove it to avoid loader context problems. "
Thanks for the heads up on the message. It nailed exactly what the problem was. Now just need to figure out why the build is placing the AddInView.dll in the addins addin subdirectory.
Feb 26, 2008 at 6:25 PM
It is probably your add-in project that is doing this. Check the dependency in your add-in project to the AddInView and see if in the properties "Copy-local" is set to true. If it is you just need to set it to false and you'll be set (you'll of course also need to delete any copies that are already there).

Feb 26, 2008 at 8:35 PM
Yes, "Copy Local" was set to true. Thanks.
Feb 27, 2008 at 6:17 PM

Can you wipe your entire addin structure. Oh, rename it or something in case there's something in there you want.

I think you probably have an old file hanging around in the wrong location. You could just delete teh specifci files that it found in AddIns.

Feb 28, 2008 at 7:19 PM

Thanks for your response. The AddInView.dll was being copied into my AddIns subdirectory due to the "Copy Local" property for the AddInView reference being set to true. Since the property was changed to false and the dll was deleted from the subdirectory the addins are now being found.

Mar 17, 2008 at 6:52 PM
I'm having a similar problem in my project: AddInStore.FindAddIns is also unable to find any addins.

At first I was having the same issue of multiple dll's in my Pipeline folders, but after having resolved this, I still don't get any plugins using AddInStore.FindAddIns.

AddInStore.Rebuild(folderName) doesn't return any warning messages, and I have been able to find my AddIn while debugging in AddInStore.StateCache once. It doesn't appear there anymore either though..

Does anyone here have any suggestions what I might be doing wrong?
Mar 17, 2008 at 8:20 PM

I just solved a similar problem. In my case, I forgot to set my AddIn to public.

Mar 18, 2008 at 10:36 AM

Thanks for the response.
In my solution this is not the case; my AddIn, Contract, Views and Adapters are all public, as well as their methods..
Mar 18, 2008 at 2:38 PM
I found the cause why AddInStore.FindAddIns didn't find my AddIns.
Appearantly my AddIn inherited from the host view instead of the addin view..
Oct 10, 2008 at 9:49 PM
I am having the same problem -- AddInStore.FindAddIns returns a collection of 0 AddInToken objects.

The AddInView assembly is not present in the AddIn's output directory (Copy Local = False), AddInStore.Update/Rebuild returns no warning messages, my AddIn is public, inherits form the AddInView interface, and is attributed with AddInAttribute.  I don't know what else to check.

When I re-create the solution from scratch (never using the VS Plug-in to generate code), everything seems to work fine.  I have yet to get the PipelineBuilder working.  Are there any other ideas/suggestions?
Oct 13, 2008 at 4:59 PM

I would check the output directory structure. Your host should be have a Build Output Path of “..\output\” and the addins for your host must be under the “..\output\AddIns\......\” subdirectory. The “……\” I use to group my addins by a particular namespace. The main part is that the AddIns subdirectory is found in the same subdirectory as the Host. I haven’t tried anything but this default way of doing things.

I was just checking on Pipeline Builder and mine may be broke also. Used to be available under Tools but the little Happy Face is not there now. This may be a problem with SP1. It does show up under the Tools/Add-in Manager as an Available Add-in and it uninstalls and reinstalls but when added back as an Add-in does not show up as a Tool to be used.