Referenced assemblies set to copy local are not copied to the output directory
See original GitHub issue@nefcanto commented on Sat Dec 23 2017
Referenced assemblies which are set to Copy Local are not copied to the output directory
I’ve described this in this StackOverflow question too.
I want to work with Azure Storage. I’ve added Nuget package references, this way:
<ItemGroup>
<PackageReference Include="WindowsAzure.Storage" Version="8.7.0" />
<PackageReference Include="Microsoft.WindowsAzure.ConfigurationManager" Version="3.2.3" />
</ItemGroup>
However, when I build the project (which is a web project by the way), I receive an error that it can’t find the required DLL files from these packages. When I look at the output folder which is bin\Debug\netcoreapp2.0\
in my case, I see that no DLL from those packages exist in that folder.
The point that it can’t find those DLL files means that something is not working properly. We expect by including a package reference in CSPROJ, all of the required actions be taken care of automatically.
So, I decided to add extra lines of code, to explicitly copy the required DLL files to the output folder:
<ItemGroup>
<Reference Include="Microsoft.WindowsAzure.Configuration">
<HintPath>..\Microsoft.WindowsAzure.Configuration.dll</HintPath>
<Private>true</Private>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage">
<HintPath>..\Microsoft.WindowsAzure.Storage.dll</HintPath>
<Private>true</Private>
</Reference>
</ItemGroup>
But they are not getting copied. What’s the problem?
@Petermarcu commented on Sat Dec 23 2017
I think you need to go back to package references and you need to do dotnet publish
to produce a build of your application with everything copied. dotnet build
and dotnet run
do things the “fast way” which is to reference things where they are on disk and avoid the cost of copying to the app folder. Publish is the way to build your final application with everything copied local. Make sure you run your app from the publish folder at that point using dotnet path/to/publish/folder/App.dll
.
@brentmorrisa commented on Fri Feb 09 2018
Dotnet publish is not getting my copy-local true files, either.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
I met the same issue on VS 2017 Enterprise 15.8.4. Anyone know if there has been a fix for it?
If you create a new .net core wpf project and add a com dependency the related dll will also not copied on publishing to the output directory.
Sample