0

I'm trying to add a project ref to my main solution but unable to do so. I tried: Manually adding it from references option but the dll was not found. Changed the target version as well but no effect. FYI both projects have the same target version. Tried reinstalling VS as well.

Are there any other way to achieve this?

Coding_ninja
  • 121
  • 7
  • 2
    Project references are only for the case where both projects are in the same solution. – Klaus Gütter Jan 06 '23 at 08:21
  • 1
    I agree with @KlausGütter. if they are in the same solutions then what are their respective target frameworks – Vivek Nuna Jan 06 '23 at 08:31
  • No they are not in the same solution. Is there a different way I can still use their reference? @KlausGütter – Coding_ninja Jan 06 '23 at 08:43
  • 2
    If you just want to reference the DLL and you know its location, add reference and choose Browse. Click Browse button to navigate to your DLL and select it. Or add the project to your solution and then add it as a project reference – Jon Roberts Jan 06 '23 at 09:04
  • I did try that option but there's no dll file showing for the project that I wanna add @JonRoberts – Coding_ninja Jan 06 '23 at 09:19
  • 1
    Refer to this answer - https://stackoverflow.com/questions/12992286/how-to-add-a-dll-reference-to-a-project-in-visual-studio it suggests adding it through NuGet Package Manager – ChrisBD Jan 06 '23 at 09:34
  • @Coding_ninja if you go to the output folder for the project - bin\Release it should be there. Is the project a class library? If not, the output is an exe file, use that. – Jon Roberts Jan 06 '23 at 09:41
  • @JonRoberts It's not a class library, nothing there is bin/release. – Coding_ninja Jan 06 '23 at 13:30
  • I think you'd better to try to "add the project to your solution" like Jon said.... You seem to have a complex target to reference... maybe it also needs to consider if it could be referenced.... – Tiny Wang Jan 09 '23 at 02:29

1 Answers1

0

Right.

If they are in different solutions (and repositories) I recommend using nuget packages instead so you would dotnet publish yourproject and then push those packages to a nuget.org, a private (locally, something like C:\localnuget folder) or a private feed (gitlab, github and such).

If you don't have that scenario you would be better of adding the projects to your solution instead of adding DLL references. You will be able to keep them updated without the need of recompiling everything each time you need to change something.

Morilon
  • 416
  • 1
  • 4
  • 10