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.

error MSB3021: Unable to copy file

See original GitHub issue
/usr/share/dotnet/sdk/2.0.2/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): error MSB3021: Unable to copy file . . .
. . . . Could not find a part of the path  .  . .
# dotnet --info
.NET Command Line Tools (2.0.2)

Product Information:
 Version:            2.0.2
 Commit SHA-1 hash:  a04b4bf512

Runtime Environment:
 OS Name:     debian
 OS Version:  9
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/2.0.2/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Eshvacommented, Nov 29, 2017

@alvarollmenezes Just delete bin/Debug/ folder(s) before you build .NET Core assemblies. In my case I build using npm script and the script looks like this: "build:linux:service:dev": "rm -r -f ../bin/deb/core/linux-x64/ && dotnet publish ../EveHQ-NG.sln --runtime linux-x64 --configuration Debug --self-contained", You can see it in this file: project.json

0reactions
mbpcommented, Oct 3, 2018

I experienced this problem as well, and solved it by using correct casing for filenames

E.g. there was a folder wwwroot/Scripts but tsconfig.json had "outFile": "wwwroot/scripts/foo.js". Changing the outfile directory to capital S fixed it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MSBuild error MSB3021: Unable to copy file. Could not find ...
If your Build is being ruined by MSB3021, start with checking your antivirus settings. Mine has a feature called Real-time file system ...
Read more >
How to kill the process causing the "MSB3021 Unable to copy ...
Open a command prompt as admin. You'll need an elevated command prompt. · Taskkill time! Run this in the command prompt: · Debug...
Read more >
Error MSB3021 Unable to copy file - Developer Community
Based on the error message, the application itself is still running and holding a lock on the .exe file. See this message: The...
Read more >
MSBuild error MSB3021: Unable to copy file ... - YouTrack
The exact error seems like it is trying to copy a file that does not exist yet. Like its accessing a DLL from...
Read more >
Error MSB3021 Access to the path 'EpicGames.Core.dll' is ...
Try to delete the .dll files motioned in Build Output panel. For example, we have Unable to copy file "UnrealEngine\Engine\Source\Programs\ ...
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