Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

311
Vistas
Nuget Pkg Dlls Missing from Build Folder in .Net Standard DLL Project. dlls are Not Copy Local? Fix in Visual Studio 2019?

I have Visual Studio 2019 Community Edition

Steps to reproduce:

I load up VS and start a brand new C# .Net Standard Library project. I go to Nuget Pkg Manager and install ANY nuget package. I add a single line to Class1.cs to use a Type from the package.

For instance, if I install WatsonTCP nuget package, I change Class1.cs to look like this:

using System;
using WatsonTcp;

namespace NugetTest
{
    public class Class1
    {
        public Class1()
        {
            WatsonTcpClient client = new WatsonTcpClient("", 0);
        }
    }
}

I hit Rebuild Solution. I check the bin/Debug folder and none of the dlls for the nuget package are there. Same thing with bin/Release for a Release build.

I have poored through as many SO issues as I can. I've read the MSDN documentation on nuget.

I set Build and Run MSBuild settings to Detailed. In the build log, I see something like the following output for every single dll:

Primary reference "WatsonTcp, Version=2.0.7.0, Culture=neutral, PublicKeyToken=null".
Resolved file path is "C:\Users\James\.nuget\packages\watsontcp\2.0.7\lib\netstandard2.0\WatsonTcp.dll".
Reference found at search path location "{HintPathFromItem}".
This reference is not "CopyLocal" because at least one source item had "Private" set to "false" and no source items had "Private" set to "true".

I'm guessing this notice about CopyLocal is the reason nothing is being output in the build folder. But I'm not 100% sure.

SO mostly contains older questions that pertain to the pre-"package reference" era before .Net Core and .Net Standard. As a result, any time I search for issues pertaining to "CopyLocal", I get information on setting the CopyLocal property explicitly on a DLL Reference. I'm not finding anything helpful to fix my issue with automatic determination of CopyLocal by the Package Reference and RAR system.

Can anyone help?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Open your xx.csproj(In VS, double-click the project name in Solution explorer, or right-click project=>unload=>edit...) and add the CopyLocalLockFileAssemblies property into it, set its value to true and it will copy all your assemblies from nuget packages to output folder during build process.

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <!--Add this line-->
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>

And if you have too many nuget packages in your project and you only want part of them, try using PrivateAssets="All" to prevent VS from copying the specified one to output folder.

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <!--Add this line to copy everything.-->
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="log4net" Version="2.0.8" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3-beta1" />
    <PackageReference Include="WatsonTcp" Version="2.0.7" PrivateAssets="All"/>
  </ItemGroup>

Eg: Using script above will copy log4net and NewTonSoft.Json but not WatsonTcp to output folder. More details refer to github/dotnet/sdk#2235.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda