Skip to content

AutoReferenced PackageReference support to block version changes in UI for "sdk installed" packages #4044

Closed

Description

@emgarten

PackageReferences can be added to projects by external targets, these may need special steps to update beyond just changing the PackageReference. To prevent the NuGet UI and command line tools from naively changing these there should be an additional attribute that allows locking down a reference to make it read only.

Proposal

Add a ReadOnly attribute to PackageReference items that prevents tooling from changing it.

Example

<PackageReference include="NuGet.Versioning">
  <Version>3.5.0</Version>
  <ReadOnly>true</ReadOnly>
</PackageReference>

Example scenario

An SDK is referenced by a project and contains PackageReferences to bring down components used by the SDK. These packages must match the SDK version. The correct way to update the packages is to update to a newer version of the SDK.

Here the NuGet UI would show the packages as having updates, however if the user updates these packages through NuGet they will be broken.

Activity

  1. emgarten commented on Dec 1, 2016

    @emgarten
    MemberAuthor

    This could be done by adding the AllowedRange property used in packages.config to PackageReference.

    Further scenarios to consider

    • External targets file that is shared between multiple projects that contains a PackageReference
    • Shared framework scenarios, NuGet will report that an update is available, however the user doesn't have the shared framework installed yet.
  2. davidfowl commented on Dec 1, 2016

    @davidfowl
    Member

    This makes me cringe a little bit (actually a lot). Is this just optional metadata that should never really appear in my project file? Is this about hiding things from the ui?

  3. emgarten commented on Dec 1, 2016

    @emgarten
    MemberAuthor

    This would be optional metadata to hide the package from the available updates in the UI and from update all. The flag would not affect the resolver.

  4. added this to the 4.0 RTM milestone on Jan 16, 2017
  5. changed the title [-]ReadOnly PackageReference support[/-] [+]AutoReferenced PackageReference support[/+] on Jan 25, 2017
  6. changed the title [-]AutoReferenced PackageReference support[/-] [+]AutoReferenced PackageReference support to block version changes in UI for "sdk installed" packages[/+] on Jan 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions