dotnet publish fails with MSB3030
See original GitHub issuedotnet publish fails with MSB3030
We have been using the dotnet core sdk on Amazon Linux 2 for our Jenkins builds for 6 months now. We upgraded from dotnet core 2.2 to dotnet core 3.1 recently and everything has been working fine. For some unknown reason, all of our builds that use dotnet publish started failing today with an error that looks like the one shown here:
/usr/share/dotnet/sdk/3.1.101/Microsoft.Common.CurrentVersion.targets(4570,5): error MSB3030: Could not copy the file "/home/ec2-user/jenkins/workspace/data-sync-service/data-sync-service/obj/Release/netcoreapp3.1/data-sync-service" because it was not found. [/home/ec2-user/jenkins/workspace/data-sync-service/data-sync-service/data-sync-service.csproj]
As you will notice, the publish command is internally trying to copy the file “data-sync-service”, which doesn’t exist. The “data-sync-service” name is the name of the project, so the source directory is full of files that start with “data-sync-service”:
$ ls -al /home/ec2-user/jenkins/workspace/data-sync-service/data-sync-service/obj/Release/netcoreapp3.1/
total 748
drwxrwxr-x 3 ec2-user ec2-user 4096 Jan 27 19:00 .
drwxrwxr-x 3 ec2-user ec2-user 27 Jan 27 18:59 ..
-rw-rw-r-- 1 ec2-user ec2-user 1105 Jan 27 18:59 data-sync-service.AssemblyInfo.cs
-rw-rw-r-- 1 ec2-user ec2-user 41 Jan 27 18:59 data-sync-service.AssemblyInfoInputs.cache
-rw-rw-r-- 1 ec2-user ec2-user 149775 Jan 27 18:59 data-sync-service.assets.cache
-rw-rw-r-- 1 ec2-user ec2-user 209999 Jan 27 18:59 data-sync-service.csprojAssemblyReference.cache
-rw-rw-r-- 1 ec2-user ec2-user 0 Jan 27 19:08 data-sync-service.csproj.CopyComplete
-rw-rw-r-- 1 ec2-user ec2-user 20008 Jan 27 19:08 data-sync-service.csproj.FileListAbsolute.txt
-rw-rw-r-- 1 ec2-user ec2-user 292352 Jan 27 19:08 data-sync-service.dll
-rw-rw-r-- 1 ec2-user ec2-user 0 Jan 27 18:59 data-sync-service.MvcApplicationPartsAssemblyInfo.cache
-rw-rw-r-- 1 ec2-user ec2-user 662 Jan 27 18:59 data-sync-service.MvcApplicationPartsAssemblyInfo.cs
-rw-rw-r-- 1 ec2-user ec2-user 64284 Jan 27 19:08 data-sync-service.pdb
-rw-rw-r-- 1 ec2-user ec2-user 41 Jan 27 19:00 data-sync-service.RazorTargetAssemblyInfo.cache
drwxrwxr-x 2 ec2-user ec2-user 107 Jan 27 18:59 staticwebassets
We are using the following command being executed by Jenkins:
dotnet publish /home/ec2-user/jenkins/workspace/data-sync-service/data-sync-service/data-sync-service.csproj --no-restore -c Release -o /home/ec2-user/jenkins/workspace/data-sync-service/data-sync-service/out
I compared the CurrentVersions.target file with those on other machines and they are identical. The same builds work fine on other machines but are failing on our Jenkins slave.
General
dotnet core sdk version: 3.1.101 OS: Amazon Linux 2 (4.14.133-113.112.amzn2.x86_64 dotnet/core#1 SMP Tue Jul 30 18:29:50 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (1 by maintainers)
Top GitHub Comments
I applied the 3.1.102 update yesterday to my Jenkins slave. Now I am hitting this issue again:
By rebuilding the slave EC2 instance from scratch (with the current dotnet version), everything works fine. I hope we can identify the source of the problem and correct it before the next dotnet sdk update…
@nguerrera, did the binary log give you any insight into the cause of the problem?
Same problem here. I upgraded project from .netcore 2.2 to .netcore 3.1 and this occurs regularly.