none
Shared Project VB cannot be added as a reference to other projects in the same solution

    Question

  • I added a Shared Project VB to my solution to be able to share code in 2 VSTO AddIns all in the same solution. Where the application type is ClassLibrary.

    Now I want to add a references in the other projects to the Shared Project and use the code.

    Unfortunately this is not possibly because in the Reference Manager the Shared Project is not visible under the point Project/Solution.

    What do I have to do else that the Reference Manager sees the Shared Project?

    --> The Shared Project is also not listed in the Configuration Manager of the solution.

    Thanks in advance for help!

    I use Visual Studio 2015

    • Edited by monbrot Friday, April 7, 2017 12:26 PM
    Friday, April 7, 2017 11:27 AM

Answers

All replies

  • Hi monbrot,

    I try to add shared project in my project and then I can add this shared project  as reference in the other project. Please select one project---right-click reference---select Add reference---select shared projects/solution, then you can select the shared projects that you have added.

    Best Regards,

    Cherry Bu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 11, 2017 9:19 AM
    Moderator
  • I added a Shared Project VB to my solution to be able to share code in 2 VSTO AddIns all in the same solution. Where the application type is ClassLibrary.

    Now I want to add a references in the other projects to the Shared Project and use the code.

    Have you built the class library? It doesn't exist until you build it.

    Tuesday, April 11, 2017 9:46 AM
  • Is your Shared Project written in VB.NET too?

    I do not think that Shared Projects have to be listed in Configuration Manager, since they are compiled according to the parent projects. They also do not have Project Properties pages.


    • Edited by Viorel_MVP Tuesday, April 11, 2017 11:35 AM
    Tuesday, April 11, 2017 11:34 AM
  • I guess you did something wrong

    I've simply set the reference at program level (in reference choosing that (did you check the check box by the way?)


    Success
    Cor

    Tuesday, April 11, 2017 12:03 PM
  • Thank you for the replies.

    Actually I realized that I have a  problem with my Visual Studio installation aswell, so maybe that is the issue.

    I get back to this problem when fixed the installation problem.

    But what I read above, it should work, but to be more clear:

    - I have one VSTO AddIn project written in VB with application type ClassLibrary

    - I added 1 Shared Project in VB

    - I want to add a reference in the VSTO AddIn to the Shared Library

    - I want to add a second VSTO ADDIn in VB and share the SharedProject in it

    If anyone can tell that this will not work, please tell me why and what I could do else.

    Wednesday, April 12, 2017 5:35 PM
  • Did you look at my reply, it is in fact shown in it. 

    1. Open one of the 2 projects
    2. Do File Add Existent and select the other project
    3. Set with right click on it the UI project as Startup Project
    4. Do in that Add Reference and select Program, select the other program and don't forget to check the box)

    Click Start. 


    Success
    Cor

    Wednesday, April 12, 2017 5:40 PM
  • Seems that such references are not supported in case of VSTO AddIns. (Checked in Visual Studio 2017 too). Therefore, consider Class Libraries instead of Shared Projects.

    See also: https://social.msdn.microsoft.com/Forums/vstudio/en-US/4ac44fb6-29cf-4e43-9cf0-a8fb701cff95

    • Edited by Viorel_MVP Wednesday, April 12, 2017 5:50 PM
    • Marked as answer by monbrot Wednesday, April 19, 2017 2:05 PM
    Wednesday, April 12, 2017 5:47 PM
  • Thanks a lot Viorel! I will try this out.

    For further questions about Class Libraries I will open a new Thread.

    Wednesday, April 19, 2017 2:05 PM