Skip to content

feat: Add cleanup logic for workdirectory before build projects#3175

Open
filzrev wants to merge 1 commit into
dotnet:masterfrom
filzrev:feat-add-workdirectory-cleanup-before-build
Open

feat: Add cleanup logic for workdirectory before build projects#3175
filzrev wants to merge 1 commit into
dotnet:masterfrom
filzrev:feat-add-workdirectory-cleanup-before-build

Conversation

@filzrev

@filzrev filzrev commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

This PR intended to fix #3174

What's changed in this PR

  1. Add FileCleanupHelper helper class
  2. Modify GeneratorBase.cs and add cleanup logics for files/directories that returned by GetArtifactsToCleanup
  3. Modify BenchmarkRunnerClean.cs logics to support following scenario.
    3.1 Delete file that have ReadOnly attribute (on Windows)
    3.2. Continue processing when exception occurred.

{
var buildArtifactsDirectoryName = new DirectoryInfo(artifactsPaths.BuildArtifactsDirectoryPath).Name;

// Check directory name to skip BenchmarkDotNet.Toolchains.Roslyn.Generator

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of checking this way, you could make this method virtual and override it in DotNetCliGenerator.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've simplified code to cleanup files/directories that are returned by existing GetArtifactsToCleanup method.

@filzrev filzrev force-pushed the feat-add-workdirectory-cleanup-before-build branch 2 times, most recently from 1bcb9c1 to e814c7d Compare June 18, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some benchmark failed on second execution when using --keepFiles option

2 participants