dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.96k stars 4.03k forks source link

Dependency not getting copied to bin #44659

Open Regenhardt opened 4 years ago

Regenhardt commented 4 years ago

Version Used: Visual Studio 2019 16.6.0 Steps to Reproduce:

  1. Project with folliwing structure: Proj.Api (net461 WebApi) Proj.Core (net461 library) Proj.Adapter (netstandard20 library)

Both Api and Adapter reference Core. Core has no dependencies. Api references Adapter and injects an Adapter.Service in startup. Api has a controller that calls Adapter.Service.Method().

  1. Install System.Configuration.ConfigurationManager into Adapter using NuGet. Adapter.Service.Method() uses ConfigurationManager.AppSettings["SomeSetting"]. (Add SomeSetting to the Web.Config of the Api).
  2. Build and run Proj.Api

Expected Behavior: Api should call Adapter and run Adapter.Service.Method(). Actual Behavior: System.Configuration.ConfigurationManager isn't copied to the Api/bin directory. DI throws an exception about System.Configuration.ConfigurationManager not being found while trying to instantiate Adapter.Service.

Regenhardt commented 4 years ago

Update: Sometimes my local nuget does funny things, so I tried it in the server (which runs perfectly): Same problem. No System.Configuration.ConfigurationManager found in the /bin directory.

VS shows the package with a path to %USERPROFILE%\.nuget, but apparently doesn't copy it to output.

The .Adapter project uses PackageReference. The .Api and .Core projects use packages.config, not PackageReference.