I have created a new web site using Visual Studio 2017. The target framework for this site is NetCoreApp 1.1. As this is an MVC project, it references a number of Microsoft and third-party dlls from Nuget. I also have a data project that I created as a library. It is Netstandard1.6. When I build the solution, none of the dlls from the Nuget packages are copied to the bin folder. This causes the app to crash with a FileNotFound exception when attempting to debug it. The project references are being copied correctly, so it appears to only be a problem with Nuget packages. As a workaround, I can publish the project and copy that output to the bin folder, but I shouldn't have to do that, should I?
.NET Core uses the generated .deps.json
file in the output to resolve assemblies, so it avoids copying the files unnecessarily during the build.
However if some assemblies try to look for other assemblies in the output directory or the files referenced in the deps.json
file cannot be accessed (e.g. testing build output in IIS), you can add this to a <PropertyGroup>
element in your csproj file to cause the NuGet assemblies to be copied to the output directory:
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With