question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
su-jiecommented, Sep 18, 2018

I met the same issue on VS 2017 Enterprise 15.8.4. Anyone know if there has been a fix for it?

0reactions
sidatacomcommented, Feb 20, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Assembly referenced in csproj is not copied to output ...
The reason is that is because I don't want all assemblies from all .NET Core to get copied to my output folder. Now...
Read more >
Referenced assemblies set to copy local are not ...
Referenced assemblies which are set to Copy Local are not copied to the output directory I've described this in this StackOverflow question ...
Read more >
Don't copy my referenced assemblies - Thomas Freudenberg
There are cases where you don't want referenced assemblies to be copied to your output folder.
Read more >
Copying References to a Local Path - RAD Studio
In the Project Manager, right-click an assembly DLL in the References folder. · Set the Copy Local option to copy the file to...
Read more >
GAC Assemblies Copied Local - Developer Community
In project 1 the 3rd party assemblies have Copy Local set to False and indeed, they are not copied to the project output...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found