Skip to content

Conversation

@maxrake
Copy link
Contributor

@maxrake maxrake commented Dec 20, 2024

This change updates the msbuild lockfile parser so that it will not allow for missing names and or versions. Before this change, a *.csproj file parsed as a lockfile (e.g., with type of msbuild) would show entries with missing name or version as an empty string. This causes analysis failures when submitting to the API since a valid package descriptor requires a non-empty version field.

Dependency management in NuGet's "Central Package Management" (CPM) allows for *.csproj files containing PackageReference elements without a Version attribute. Those versions will be included, along with the fully transitive set, in the packages.lock.json lockfile generated by NuGet. When both files are present in the same directory, the changes in this patch will correctly parse both. For more about CPM, see this reference:

https://devblogs.microsoft.com/nuget/introducing-central-package-management/

The sample.csproj test fixture was updated to include an entry with neither a name or version and another entry with a name but no version.

This change updates the `msbuild` lockfile parser so that it will not
allow for missing names and or versions. Before this change, a
`*.csproj` file parsed as a lockfile (e.g., with type of `msbuild`)
would show entries with missing name or version as an empty string. This
causes analysis failures when submitting to the API since a valid
package descriptor requires a non-empty `version` field.

Dependency management in NuGet's "Central Package Management" (CPM)
allows for `*.csproj` files containing `PackageReference` elements
without a `Version` attribute. Those versions will be included, along
with the fully transitive set, in the `packages.lock.json` lockfile
generated by NuGet. When both files are present in the same directory,
the changes in this patch will correctly parse both. For more about CPM,
see this reference:

https://devblogs.microsoft.com/nuget/introducing-central-package-management/

The `sample.csproj` test fixture was updated to include an entry with
neither a name or version and another entry with a name but no version.
@maxrake maxrake requested a review from cd-work December 20, 2024 20:06
@maxrake maxrake self-assigned this Dec 20, 2024
@maxrake maxrake requested a review from a team as a code owner December 20, 2024 20:06
@maxrake maxrake merged commit d0323dd into main Dec 20, 2024
17 checks passed
@maxrake maxrake deleted the cpm_fix branch December 20, 2024 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants