0

I have a .netstandard (V2.0) project (called X) that has dependency on Newtonsoft.Json (V 13.0.1) through package reference.

There is a .net 5.0 library project (Called B) that references X. When I build the project "B", in bin folder I can see the X.dll but the "Newtonsoft.Json" dll file is not copied.

If I add "Exe" to project B, it will copy "Newtonsoft.Json" dll to bin folder.

<OutputType>Exe</OutputType>

How can I make the simple library project (B) to have X and its dependencies?

Update

The suggested approaches and answers, like "dotnet publish" and "CopyLocalLockFileAssemblies" does not work in this case. The important reason is that the library "A" should be published as Nuget package and be used in other projects. So when referenced, we need the "Newtonsoft.Json" dll be imported like A.dll.

Babak Fakhriloo
  • 2,076
  • 4
  • 44
  • 80
  • Have you tried *publishing* the project instead of just building it? Run `dotnet publish` and look in the output directory indicated. – Jon Skeet Aug 13 '21 at 11:13
  • Does this answer your question? [How do I get .NET Core projects to copy NuGet references to the build output?](https://stackoverflow.com/questions/43837638/how-do-i-get-net-core-projects-to-copy-nuget-references-to-the-build-output) – Eriawan Kusumawardhono Aug 13 '21 at 12:25
  • I have already tried both suggestion, the issue is that due to company policies I can not use suggested approaches. Besides, I have to create a nuget package of the solution and in that case the suggested solution does not work for me. – Babak Fakhriloo Aug 15 '21 at 09:16

0 Answers0