dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.68k stars 1.06k forks source link

error MSB3021: Unable to copy file #1707

Open ousiax opened 6 years ago

ousiax commented 6 years ago
/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
livarcocc commented 6 years ago

Can you provide any additional repro steps?

ousiax commented 6 years ago

@livarcocc

Hi, I have reproduced the problem. The repo url is https://github.com/qqbuby/MSB3021.

README.md

$ ./docker-build.sh
+ WORK_DIR=/tmp/MSB3021
+ docker run -it --rm -v /tmp/MSB3021/:/msb3021 -w /msb3021 microsoft/aspnetcore-build:1.0-2.0 /bin/bash build.sh
+ git clean -dfx
Removing src/website/bin/
Removing src/website/obj/
+ dotnet publish src/website/
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  website -> /msb3021/src/website/bin/Debug/netcoreapp2.0/website.dll
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): warning MSB3026: Could not copy "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Beginning retry 1 in 1000ms. Could not find a part of the path '/msb3021/src/website/bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js'. [/msb3021/src/website/website.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): warning MSB3026: Could not copy "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Beginning retry 2 in 1000ms. Could not find a part of the path '/msb3021/src/website/bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js'. [/msb3021/src/website/website.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): warning MSB3026: Could not copy "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Beginning retry 3 in 1000ms. Could not find a part of the path '/msb3021/src/website/bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js'. [/msb3021/src/website/website.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): warning MSB3026: Could not copy "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Beginning retry 4 in 1000ms. Could not find a part of the path '/msb3021/src/website/bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js'. [/msb3021/src/website/website.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): warning MSB3026: Could not copy "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Beginning retry 5 in 1000ms. Could not find a part of the path '/msb3021/src/website/bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js'. [/msb3021/src/website/website.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): warning MSB3026: Could not copy "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Beginning retry 6 in 1000ms. Could not find a part of the path '/msb3021/src/website/bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js'. [/msb3021/src/website/website.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): warning MSB3026: Could not copy "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Beginning retry 7 in 1000ms. Could not find a part of the path '/msb3021/src/website/bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js'. [/msb3021/src/website/website.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): warning MSB3026: Could not copy "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Beginning retry 8 in 1000ms. Could not find a part of the path '/msb3021/src/website/bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js'. [/msb3021/src/website/website.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): warning MSB3026: Could not copy "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Beginning retry 9 in 1000ms. Could not find a part of the path '/msb3021/src/website/bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js'. [/msb3021/src/website/website.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): warning MSB3026: Could not copy "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Beginning retry 10 in 1000ms. Could not find a part of the path '/msb3021/src/website/bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js'. [/msb3021/src/website/website.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): error MSB3027: Could not copy "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Exceeded retry count of 10. Failed. [/msb3021/src/website/website.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): error MSB3021: Unable to copy file "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Could not find a part of the path '/msb3021/src/website/bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js'. [/msb3021/src/website/website.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): warning MSB3026: Could not copy "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Beginning retry 1 in 1000ms. Could not find a part of the path '/msb3021/src/website/bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js'. [/msb3021/src/website/website.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): warning MSB3026: Could not copy "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Beginning retry 2 in 1000ms. Could not find a part of the path '/msb3021/src/website/bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js'. [/msb3021/src/website/website.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Publish.targets(109,5): warning MSB3026: Could not copy "/msb3021/src/website/wwwroot/lib/scripts/clientApp/commonDirectives/module/module11.js" to "bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js". Beginning retry 3 in 1000ms. Could not find a part of the path '/msb3021/src/website/bin/Debug/netcoreapp2.0/publish/wwwroot/lib/scripts/clientApp/commonDirectives/Module/module11.js'. [/msb3021/src/website/website.csproj]
^CAttempting to cancel the build...
ousiax commented 6 years ago

Any update?

livarcocc commented 6 years ago

We haven't looked into this yet.

Eshva commented 6 years ago

@qqbuby As workaround you can add removing the target bin directory in your build script before you build.

alvarollmenezes commented 6 years ago

I have the same problem publishing this project https://github.com/prodest/sistema-classificacao-documental on linux environments.

Tried on ubuntu 14 and on dotnet docker container (2.0-sdk) https://hub.docker.com/r/microsoft/dotnet/.

There are some logs on travis and circle-ci: Here https://travis-ci.org/prodest/sistema-classificacao-documental/builds/309105906 and here https://circleci.com/gh/prodest/sistema-classificacao-documental/4 .

Publishes correctly with debian.8-x64 release on windows cli.

alvarollmenezes commented 6 years ago

@Eshva Sorry, I don't get your workaround, could you elaborate?

Eshva commented 6 years ago

@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

alvarollmenezes commented 6 years ago

@Eshva thank you. But didn't solve the error for me.

ousiax commented 6 years ago

I use the wwwroot-gen.sh as below to generate static files with same dir name $MODULE0 and $MODULE1.

On windows, .../Module and .../module are same, however there are different on linux.

God bless, with the notice above, we can reproduce the problem, so ...

#!/bin/bash

MODULE0=wwwroot/lib/scripts/clientApp/commonDirectives/Module
MODULE1=wwwroot/lib/scripts/clientApp/commonDirectives/module

if [ ! -d $MODULE0 ]; then
    mkdir -p $MODULE0
fi

if [ ! -d $MODULE1 ]; then
    mkdir -p $MODULE1
fi

for n in {1..50}; do
    touch $MODULE0/module$n.js
    touch $MODULE1/module$n.js
done

MODULE0=wwwroot/lib/scripts/clientApp/commonDirectives/Module MODULE1=wwwroot/lib/scripts/clientApp/commonDirectives/module

mbp commented 6 years ago

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.

github-actions[bot] commented 6 days ago

Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label.