From 46ed7bf7fcd2ef0e3e90470ed26ecdfeae5e31e8 Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Thu, 16 Nov 2023 16:57:01 +0100 Subject: [PATCH] Create empty Directory.Build.props to ignore other prop files --- .../Toolchains/CsProj/CsProjGenerator.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs b/src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs index eaf1da4683..288ba56f3f 100644 --- a/src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs @@ -87,6 +87,22 @@ protected override void GenerateProject(BuildPartition buildPartition, Artifacts .ToString(); File.WriteAllText(artifactsPaths.ProjectFilePath, content); + + // We create an empty Directory.Build.props file next to the project file to ignore other prop files + // https://github.com/dotnet/BenchmarkDotNet/issues/2371#issuecomment-1814709479 + string propsFilePath = Path.Combine(Path.GetDirectoryName(artifactsPaths.ProjectFilePath), "Directory.Build.props"); + if (!File.Exists(propsFilePath)) + { + File.WriteAllText(propsFilePath, @" + + + + false + false + +"); + } } ///