-1

Visual Studio 2019.

I have several assemblies in my projects. Assembly A (nuget package), Assembly B - references to assembly A and use some classes from it, Application C - references to Assembly B and use code that inside using code from assembly A,

When building, output for assembly B contains assembly A, but application C doesn't contain assembly A.

Is any change to get assembly A goes to output folder for application, without referencing it directly?

Warr
  • 118
  • 6
  • What target frameworks are the various projects? There is a known issue, sorry I can't find it exactly but I think happens when netfx references netstandard libraries, it doesn't pull in the references of references. If you use package references instead of packages.config, I think it solves it. – Luke Briner Dec 03 '21 at 12:29
  • .net framework 4.6.1 – Warr Dec 03 '21 at 12:31
  • Probably this: https://www.hanselman.com/blog/referencing-net-standard-assemblies-from-both-net-core-and-net-framework which is what I mentioned above. Can you right-click the packages.config for project C and choose "Convert to package references"? – Luke Briner Dec 03 '21 at 12:33
  • https://stackoverflow.com/questions/45464271/include-nuget-dependencies-in-my-build-output – Hans Passant Dec 03 '21 at 13:38

1 Answers1

1

When netfx projects using packages.config reference a netfx shared library, the relevant references are copied across to the netfx project since the dlls are packaged with nuget. Netstandard, however, does not include the dlss in the package but expects the top-level project to read the nuget references and get them itself.

When using packages.config, this doesn't work so the references are missing. If you are using package reference, then it does work.

The solution is either to not use netstandard (which would be a shame); reference the missing nugets directly; or ideally, change your project to package reference, if you can, so it works.

Right-click packages.config and "Convert to package reference"

Luke Briner
  • 708
  • 4
  • 21