0

I have a solution AddLog which has only one project AddLogClient of type shared project. I created it by right clicking on solution name->Add->Shared Project.

enter image description here

I want to use this shared project in other solutions. When I go to another solution MyApplication and want to add a reference to AddLogClient, I can't see it in the list of shared projects, because it is not located in the same solution. When I try to browse for it, it expects a file in .exe, .dll, .tlb, .olb, .olx or .winmd format. Adding .dll file (from bin folder from AddLogClient) would not be acceptable because every developer has different repository checkout location and we can't use relative paths.

enter image description here

How can I reference shared project from other solutions? Both solutions are under SVN.

Sam Carlson
  • 1,891
  • 1
  • 17
  • 44
  • can't you use the `.csproj` file of `AddLogClient` to add it to your solution ? – Shahryar Saljoughi Feb 23 '20 at 16:22
  • A SharedProject is not actually what you think it means. It is a project used to share code between multiple assemblies, Take a look at this SO answer which clears that up: https://stackoverflow.com/a/30638495/4482565 – Sotiris Panopoulos Feb 23 '20 at 16:24
  • If I reference `.csproj` file, then developers of solution `MyApplication` can still see and modify the code of `AddLogClient`. What if I don't want that? I just want to provide them some functions to use without exposing source code. – Sam Carlson Feb 23 '20 at 16:26
  • 1
    The standard way of doing this then is using a NuGet package. Consider using a private hosted Nuget server on your premises to isolate your codebase from the outside world. – Sotiris Panopoulos Feb 23 '20 at 16:35
  • Thank you for NuGet suggestion. Is there no way to use the same shared project from multiple solutions? – Sam Carlson Feb 23 '20 at 16:44

1 Answers1

1

The standard way of doing so, as @Sokopa suggested is through NuGet. For dev purposes, if you do not want to publish packages to Nuget servers, you can check the Generate Nuget Package on Build option and upon build it will create a nuget package in your build folder.

check this guide from microsoft docs