Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

PackageReference: parse version from xml attr #247

Merged
merged 3 commits into from
Jun 4, 2021

Conversation

cnr
Copy link
Contributor

@cnr cnr commented Jun 4, 2021

Overview

In fossa-cli and here, we're parsing versions incorrectly in .csproj/.vbproj/etc files

We were looking for Version as a child element, when it's actually an attribute:

Acceptance criteria

Versions are parsed correctly for packages in PackageReference elements

Testing plan

The relevant test file was updated

@cnr cnr requested a review from zlav June 4, 2021 15:49
@cnr cnr self-assigned this Jun 4, 2021
@zlav
Copy link
Member

zlav commented Jun 4, 2021

Great find although I think this is only correct for newer versions of dotnet but I don't believe it has always been true. This is the repository that I tested against and a link to the csproj file. The most recent master commit on the repository does follow the format you are fixing for, but I believe this format was allowed for quite some time.

How difficult would it be to parse both version fields as optional and then choose one? I think this would be the correct thing to do.

@cnr
Copy link
Contributor Author

cnr commented Jun 4, 2021

Interesting -- I'll have it parse both

Copy link
Member

@zlav zlav left a comment

Choose a reason for hiding this comment

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

Good catch!

@cnr cnr force-pushed the package-reference-versions branch from 9befab9 to 702dea4 Compare June 4, 2021 18:52
@cnr cnr merged commit 3cf4b15 into master Jun 4, 2021
@cnr cnr deleted the package-reference-versions branch June 4, 2021 19:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants