Create empty Directory.Build.props to ignore other prop files

This commit is contained in:
Adam Sitnik 2023-11-16 16:57:01 +01:00
Родитель 630622b6df
Коммит 46ed7bf7fc
1 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -87,6 +87,22 @@ namespace BenchmarkDotNet.Toolchains.CsProj
.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, @"
<Project>
<!-- This is an empty Directory.Build.props file to prevent projects which reside
under this directory to use any of the repository local settings. -->
<PropertyGroup>
<ImportDirectoryPackagesProps>false</ImportDirectoryPackagesProps>
<ImportDirectoryBuildTargets>false</ImportDirectoryBuildTargets>
</PropertyGroup>
</Project>");
}
}
/// <summary>