Skip to content

Commit

Permalink
fix(manager/nuget): case-insenstive version extraction (#28666)
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulGautamSingh committed Apr 26, 2024
1 parent 15d5aa2 commit f2da9c1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/modules/manager/nuget/extract.spec.ts
Expand Up @@ -60,6 +60,20 @@ describe('modules/manager/nuget/extract', () => {
expect(res?.deps).toHaveLength(17);
});

it('extracts dependency with lower-case Version attribute', async () => {
const contents = codeBlock`
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Moq" version="4.18.4" />
</ItemGroup>
</Project>`;
const res = await extractPackageFile(contents, 'some.csproj', config);
expect(res?.deps).toHaveLength(1);
});

it('extracts all dependencies from global packages file', async () => {
const packageFile = 'packages.props';
const sample = Fixtures.get(packageFile);
Expand Down
1 change: 1 addition & 0 deletions lib/modules/manager/nuget/extract.ts
Expand Up @@ -59,6 +59,7 @@ function extractDepsFromXml(xmlNode: XmlDocument): NugetPackageDependency[] {
const depName = attr?.Include || attr?.Update;
const version =
attr?.Version ??
attr?.version ??
child.valueWithPath('Version') ??
attr?.VersionOverride ??
child.valueWithPath('VersionOverride');
Expand Down

0 comments on commit f2da9c1

Please sign in to comment.