Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VMR locks files during publishing in a re-build with existing artifacts #4880

Closed
ViktorHofer opened this issue Feb 3, 2025 · 1 comment · Fixed by dotnet/arcade#15482
Closed

Comments

@ViktorHofer
Copy link
Member

ViktorHofer commented Feb 3, 2025

I noticed these failures appear when building a repository inside the VMR again (by deleting the artifacts\obj<repo-name>` folder and then invoking build.cmd). I think this started when I switched Publish.proj to use hardlinks when copying files for the VMR. I thought that this got fixed with dotnet/arcade@79e2c58 but I still see the issues with latest main.

   C:\git\dotnet\artifacts\source-built-sdks\Microsoft.DotNet.Arcade.Sdk\tools\Publish.proj(270,5): error : The proces
  s cannot access the file 'C:\git\dotnet\artifacts\packages\Release\Shipping\deployment-tools\Microsoft.Deployment.Dot
  Net.Releases.2.0.0-dev.nupkg' because it is being used by another process.

I couldn't find what's actually locking the file with handle.exe so I assume it must be directly in the Copy operation. This only happens when the file is already there (an incremental build / rebuild). So the first build must not use --clean-while-building to repro this.

@ViktorHofer ViktorHofer changed the title VMR locks files during publishing VMR locks files during publishing in a re-build with existing artifacts Feb 3, 2025
@ViktorHofer
Copy link
Member Author

ViktorHofer commented Feb 3, 2025

Relevant fix in msbuild from years ago: dotnet/msbuild@9586231.

ViktorHofer added a commit to dotnet/arcade that referenced this issue Feb 3, 2025
Make sure that a file gets deleted before a hardlink gets created.

Fixes dotnet/source-build#4880
@github-project-automation github-project-automation bot moved this from Backlog to Done in .NET Source Build Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant