Skip to content

Improve PR build reliability from Razor file copy #7081

Open
@marcpopMSFT

Description

@marcpopMSFT

this build has some failures in the Razor build because of a file copy. From looking at the code and binlong, Daniel and I think it's because that csproj multi-targets AND has a copy step that copies to the same folder.

So the two different framework builds run in parallel but that copy step overwrites (sometimes locking the files based on timing).

Fix options
Copy the files into a TFM specific folder
Only do the copy in one of the TFM legs (you'd need to determine if the other TFM would require those files to be present)

Failing target
https://github.com/dotnet/sdk/blob/bcfe2a350a4d161d3cac953c417159dbabcc3432/src/RazorSdk/Tasks/Microsoft.NET.Sdk.Razor.Tasks.csproj#L107

Failure details
D:\a\1\s\src\RazorSdk\Tasks\Microsoft.NET.Sdk.Razor.Tasks.csproj(107,5): error MSB3026: Could not copy "D:\a\1\s\src\RazorSdk\Targets\Microsoft.NET.Sdk.Razor.Component.targets" to "D:\a\1\s\artifacts\bin\Debug\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.Component.targets". Beginning retry 1 in 1000ms. The process cannot access the file 'D:\a\1\s\artifacts\bin\Debug\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.Component.targets' because it is being used by another process. [TargetFramework=net7.0]

##[error]src\RazorSdk\Tasks\Microsoft.NET.Sdk.Razor.Tasks.csproj(107,5): error MSB3026: (NETCORE_ENGINEERING_TELEMETRY=Build) Could not copy "D:\a\1\s\src\RazorSdk\Targets\Microsoft.NET.Sdk.Razor.Component.targets" to "D:\a\1\s\artifacts\bin\Debug\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.Component.targets". Beginning retry 1 in 1000ms. The process cannot access the file 'D:\a\1\s\artifacts\bin\Debug\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.Component.targets' because it is being used by another process.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions