locked
Can other projects within a solution reference an Add-in? RRS feed

  • Question

  • I am pretty sure the answer is no, but I am having some difficulty understanding this concept. Can someone clarify this or point me to some documentation that would help me "get it"?

    My VS.Net 2005 solution consists of a Word 2007 add-in (it is the Startup project in the solution).  Within this same solution, I have added 2 other projects. The Add-in references these projects.

    Now, I add a 3rd project to this solution, and I want it to access some of the public members of the Add-in project. However, when I go to the Add Reference dialog, I do not see the add-in listed as one of the available projects to be referenced (even though it is containined within the same solution).

    Am understanding this correctly, that the Add-in can only be referenced by the hosting app (Word). Even though it is a DLL, other assemblies cannot reference it. So any Public methods that I have within the add-in, are really acting in Friend scope.

    Pardon the newbie questions but I'm still getting the hang of OOP.

    Thanks

     

    Friday, March 16, 2007 8:09 PM

Answers

  • Interesting, I've never noticed that before.  I'm not sure why that's the case, other than perhaps VS doesn't consider an add-in project a "true" library which are the only things you can create project-to-project references with.  You could still use the "Browse" tab to select the assembly built by the add-in project, but sometimes this can cause file overwrite issues during a build. 

    A better approach in general would be to split out the shared content from your add-in and place it in its own library project.  Then your add-in and your new project can both reference this common project.

    -Phil

    Tuesday, March 20, 2007 9:09 PM

All replies

  • You can certainly add a reference to your add-in project from your 3rd project in the solution and that will give the new project access to all of the public types in the add-in project.  However, I suspect what you really mean is that you want to make calls on the add-in class from your new project while the add-in is running.  To do this you will need to use some sort of IPC mechanism (perhaps the running object table (ROT) by way of COM Interop, .NET remoting, or WCF).  If you could describe the intended interaction between the add-in and this 3rd project we might be able to suggest an appropriate means of communication between them.

    -Phil

    Monday, March 19, 2007 7:09 PM
  • When I go to the References dialog and choose Projects, the Add-in project does not appear as one of the projects available to reference.  All the other projects contained within the solution appear, just not the Add-in.

    I don't really need them to interact, I just wanted to reference an object that I have made public within the add-in (not the Add-in class itself).

    thanks

    kewpcg

     

     

    Tuesday, March 20, 2007 12:19 AM
  • Interesting, I've never noticed that before.  I'm not sure why that's the case, other than perhaps VS doesn't consider an add-in project a "true" library which are the only things you can create project-to-project references with.  You could still use the "Browse" tab to select the assembly built by the add-in project, but sometimes this can cause file overwrite issues during a build. 

    A better approach in general would be to split out the shared content from your add-in and place it in its own library project.  Then your add-in and your new project can both reference this common project.

    -Phil

    Tuesday, March 20, 2007 9:09 PM
  • Thanks, makes sense - I'll try that.

    kewpcg

    Wednesday, March 21, 2007 4:14 PM