Skip to content

Commit

Permalink
Fix resolving Directory.build.props - case insensitive.
Browse files Browse the repository at this point in the history
  • Loading branch information
torbacz committed Jan 7, 2025
1 parent 56fbcdf commit eacbbec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/DependencyUpdated.Projects.DotNet/DotNetUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ internal sealed class DotNetUpdater : IProjectUpdater
[
"*.csproj",
"*.nfproj",
"Directory.build.props",
"directory.build.props"
];

public IReadOnlyCollection<string> GetAllProjectFiles(string searchPath)
{
return ValidDotnetPatterns.SelectMany(dotnetPattern =>
Directory.GetFiles(searchPath, dotnetPattern, SearchOption.AllDirectories)).ToList();
Directory.GetFiles(searchPath, dotnetPattern, SearchOption.AllDirectories)).Distinct().ToList();
}

public IReadOnlyCollection<UpdateResult> HandleProjectUpdate(IReadOnlyCollection<string> fullPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
<TargetFramework>net8.0</TargetFramework>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<Content Include="Projects\SampleProject.csproj">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\DependencyUpdated.Projects.DotNet\DependencyUpdated.Projects.DotNet.csproj" />
Expand All @@ -18,6 +12,12 @@
<None Update="Projects\Nuget.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Projects\Directory.Build.props">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Content Include="Projects\SampleProject.csproj">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ public DotNetUpdaterTests()
public void GetAllProjectFiles_Should_ReturnAllProjects()
{
// Arrange
var expectedResult = new[] { Path.Combine("Projects", "SampleProject.csproj") };
var expectedResult = new[] { Path.Combine("Projects", "SampleProject.csproj"), Path.Combine("Projects", "Directory.Build.props") };

// Act
var result = _target.GetAllProjectFiles(_searchPath);

// Assert
using (new AssertionScope())
{
result.Count.Should().Be(1);
result.Count.Should().Be(2);
result.Should().ContainInOrder(expectedResult);
}
}
Expand Down

0 comments on commit eacbbec

Please sign in to comment.