none
How to refer shared project to another solution's projects? RRS feed

  • Question

  • Dear prefessionals,

    I'm using Visual Studio 2017 professionals version 15.9.3.

    And I desire to create company-wide common "shared project" written codes in C#.

    So... I generted an shared project in the new solution and wrote some codes.

    And then in spite of be added the shared project in another main solution, the "Reference manager" window ("add reference" > Projects > Solution) says "No items found".

    How to refer any shared projects to any projects in any solutions?

    Thank you in advance.

    Tuesday, December 18, 2018 2:54 AM

Answers

  • [...]

    For uncertain reasons I can't find "Shared Projects" item in the "Reference manager" window...

    Maybe the type of your main project does not allow referencing shared projects. Give some details.

    • Marked as answer by Always fresh Tuesday, December 18, 2018 11:10 PM
    Tuesday, December 18, 2018 11:22 AM

All replies

  • Dear Andrew,

    Thank you for your reply.

    I seem you told exactly except for adding "shared project" reference.

    In my attemption, the main solution has been added the "Shared project" with *.shproj file in my same filesystem and re-built. Although "Build Order" menu item is not appearerd.

    I know the menu item "Build Order" is appear when included projects such as "Class Library" (*.csproj).

    I desire that any solutions produced in my company should link specific company-wide common codes as static.

    Thank you.

    Tuesday, December 18, 2018 5:10 AM
  • [...]

    And then in spite of be added the shared project in another main solution, the "Reference manager" window ("add reference" > Projects > Solution) says "No items found".

    How to refer any shared projects to any projects in any solutions?


    Instead of “Projects > Solution”, look for “Shared Projects > Solution”.


    Tuesday, December 18, 2018 5:36 AM
  • Hi friend,

    Welcome to the MSDN forum.

    Refer to the description, your issue is about the C# development and our forum is to discuss the VS IDE, I will help you move this thread to the appropriate forum for a better support, thank you for your understanding.

    Best regards,

    Sara


    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, December 18, 2018 6:37 AM
  • Dear Viorel,

    Thank you for your reply.

    For uncertain reasons I can't find "Shared Projects" item in the "Reference manager" window...

    Tuesday, December 18, 2018 8:09 AM
  • If the project is a classlib project, then you can find the created DLL for the classlib project and put in the Bin folder of the other solution project and set reference to the DLL.

    Tuesday, December 18, 2018 8:27 AM
  • Dear Andrew,

    Thank you for your detailed explanation.

    On my VS2017, when adding a shared project into the fresh main project, "solution tree" looks like as follows:

    Solution
      SharedProject
        (SomeClass etc)
      MainProject
        Properties
        References
        (SomeClass etc)

    Just I found this solution. When I edit *.csproj file of my main project directly as follows, my main project refer the classes in the shared project and intellisense is in order. (but "Shared Project" menu item in "Reference Manager" window is still disappeared...)

    <Project ...>
     <Import Project="(*.projitems file path in shared project.  e.g. ..\..\Common\Common\Common.projitems)" Label = "Shared" />
    </Project>




    Tuesday, December 18, 2018 8:30 AM
  • Dear DA924x,

    Thank you for your reply.

    Sorry, I want to make a static linkage between main project and shared project (to generate only one executable file, without DLLs) for some reasons.



    Tuesday, December 18, 2018 8:39 AM
  • [...]

    For uncertain reasons I can't find "Shared Projects" item in the "Reference manager" window...

    Maybe the type of your main project does not allow referencing shared projects. Give some details.

    • Marked as answer by Always fresh Tuesday, December 18, 2018 11:10 PM
    Tuesday, December 18, 2018 11:22 AM
  • Hello,

    Here is a sample using a shared project.

    https://github.com/dotnetjalps/SharedProjectVS2015


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Tuesday, December 18, 2018 11:22 AM
    Moderator
  • Dear Karen,

    Thank you very much for your helpful information.

    In reference to the website and source codes you indicate, I'm clear how to create solutions with shared projects.


    • Edited by Always fresh Tuesday, December 18, 2018 11:49 PM
    Tuesday, December 18, 2018 11:22 PM
  • Dear Viorel,

    Thank you very much for your information.

    I just found this article :

    https://social.msdn.microsoft.com/Forums/en-US/4ac44fb6-29cf-4e43-9cf0-a8fb701cff95/visual-studio-2015-and-excel-addin-is-not-possible-to-reference-a-shared-project-library?forum=vsto

    Actually, my main project type is VSTO (Outlook 2013 and 2016 VSTO Add-in). When I create a ClassLibrary project with my VS2017, "Shared Projects" menu item is appear in Reference Manager window. I'm relieved that my main project files don't have collapsed so far.



    • Edited by Always fresh Tuesday, December 18, 2018 11:48 PM
    Tuesday, December 18, 2018 11:42 PM
  • Dear all,

    Thank you very much for your kindness.

    In my addition for persons having similar case, when you add a class library project into your solution contains VSTO and shared project, you can refer VSTO project to shared project via the class library (of course one more DLL file is generated).


    Wednesday, December 19, 2018 12:21 AM