7

When I try to add a missing assembly to my project (for unit testing specifically) I noticed that the Assemblies tab is missing in the "Add Reference" dialog , see:

enter image description here

Is this a bug or a expected behavior? If it's expected how we are supposed to add the missing assemblies.

Note that I already tried through Nuget package manager and still didn't work.

hdkrus
  • 420
  • 1
  • 5
  • 13
  • On Nuget Package Manager did you select `Browse` instead of `Installed` Tab? – Stam Jun 26 '19 at 15:00
  • @Stam, Yes, actually I have installed the assemblies (through Nuget) and still is not working. – hdkrus Jun 27 '19 at 11:24
  • Well I had a strange problem a couple of times with VS 2019. I was adding a package via Nuget and then VS was removing those libraries after a while. Restarting VS fixed this problem. Did you check if the lib is under Dependences/Nuget? – Stam Jun 27 '19 at 13:10
  • Yes, they are, but they show a warning icon as if they were missing – hdkrus Jun 27 '19 at 14:50
  • Do you have a warning message in the error list of vs? – Stam Jun 28 '19 at 04:19
  • The warning icon is in the Reference List, the error list only shows the missing namespace errors – hdkrus Jun 28 '19 at 04:24
  • Did you try to uninstall it and install it again from nuget? – Stam Jun 28 '19 at 04:29
  • Yes, I tried it, I even updated to latest version and rolled back to the previous and nothing. Could it be something wrong with VS 2019 or maybe .Net Core (I'm using version 3.0 preview 6 BTW) – hdkrus Jun 28 '19 at 11:45

2 Answers2

14

It is correct behaviour. The Assemblies tab is not available for Net Core projects. You wont be able to add assemblies from your system, because Net Core projects work with dependencies from Nuget. So, to add your references, you need to use the Nuget Package Manager instead.

  1. Right click your project
  2. Choose "Manage Nuget Packages"
  3. Find the package you want to add from the list
Robert Perry
  • 1,906
  • 1
  • 14
  • 14
  • @Robert_Perry the references to my assemblies are already installed in the Nuget references of my project (since I created the project as a Unit Test Core Project they were added automatically) but still got the error of the missing assemblies. – hdkrus Jun 27 '19 at 11:27
  • Have you rebuilt your solution and used the “Restore Nuget Packages” option? – Robert Perry Jun 27 '19 at 11:31
  • I think VS 2019 doesn't have the "Restore Nuget Packages" option anymore. Instead it has a "Package Restore" section and I already had everything enabled there. – hdkrus Jun 27 '19 at 12:32
  • 1
    This answer is slightly incorrect. Actually you can add assembly references from the file system, see norgie's answer below. – henon Apr 06 '22 at 20:05
5

You can add external assemblies, e.g. Rebex, by right clicking your project, select Add >> Project Reference... >> Browse and then hit the Browse button.

I've just done that using VS2019 v.16.9.4 on a .Net Core 3.1.x project. No problem at all.

norgie
  • 497
  • 7
  • 13
  • 2
    This works well. Would never have expected to be able to add assembly references under "Add Project Reference ..." – henon Apr 06 '22 at 20:03