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.

dotnet publish fails with MSB3030

See original GitHub issue

dotnet 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:open
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rpatrick00commented, Feb 27, 2020

I applied the 3.1.102 update yesterday to my Jenkins slave. Now I am hitting this issue again:

/usr/share/dotnet/sdk/3.1.102/Microsoft.Common.CurrentVersion.targets(4570,5): error MSB3030: Could not copy the file "/home/ec2-user/jenkins/workspace/citation-webapp/citation-webapp/obj/Release/netcoreapp3.1/citation-webapp" because it was not found. [/home/ec2-user/jenkins/workspace/citation-webapp/citation-webapp/citation-webapp.csproj]

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?

0reactions
faldelandcommented, Aug 12, 2021

Same problem here. I upgraded project from .netcore 2.2 to .netcore 3.1 and this occurs regularly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet publish failed for SCD : Unable to copy the project ...
dotnet publish from CLI fails with error message. error MSB3030: Could not copy the file "obj\Release\netcoreapp2.1\win-x64\Inventory.pdb"
Read more >
net core - Publish Failing because of file location
I can run ng build --prod successfully. C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish ...
Read more >
MSB3030 - MSBuild
This error occurs when a file that was supposed to be copied isn't found at the expected location. The full message resembles the...
Read more >
Error MSB3030: Could not copy the file "StaticWebAssets. ...
As you can see in the error message, the project was built using the . NET 6 SDK. To fix the error we...
Read more >
Teamcity plugin - publish fails with a very long path in error
Hi, We are using Teamcity plugin together with Octopus deploy for a . ... NET.Publish.targets(140,5): error MSB3030: Could not copy the file ...
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