You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Handle hardlinks with file-based app csc optimization (#51135)
Fixes a bug which I discovered while using file-based apps in roslyn repo with hardlinks in build opted-in (via `ROSLYNUSEHARDLINKS` env var).
The `File.Copy` resulted in "Access denied" exception. I was puzzled at first, but after some investigation discovered that's because the MSBuild task hardlinks `obj/app.dll` with `bin/app.dll` and when we then try to `File.Copy("obj/app.dll", "bin/app.dll")` it fails with that exception because it tries to write to a file which it has locked for reading (because both files are actually the same file via the hardlink).
MSBuild's Copy task doesn't have this problem because it by default checks the files have the same size and timestamp and if so, the copy is skipped. I have implemented the same behavior to fix the issue.
0 commit comments