Skip to content

ResolveNuGetPackageAssets will throw NullReferenceException when PackageVersion is not set #171

Open
@donnie-msft

Description

@donnie-msft

Moved from https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1896623

I have a legacy .csproj solution that uses Central Package Management. If I add a to a project and exclude the Version property (as expected for CPM) but forget to define the Version in Directory.Packages.props for that package ID, I get a null reference exception:

20>C:\Program Files\Microsoft Visual Studio\2022\IntPreview\MSBuild\Microsoft\NuGet\17.0\Microsoft.NuGet.targets(198,5): error : Object reference not set to an instance of an object.

NU1010: The PackageReference items RuntimeContracts do not have corresponding PackageVersion.

Related: #77

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions