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

Closed
emgarten opened this Issue Dec 1, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@emgarten
Contributor

emgarten commented Dec 1, 2016

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.

@emgarten

This comment has been minimized.

Show comment
Hide comment
@emgarten

emgarten Dec 1, 2016

Contributor

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.
Contributor

emgarten commented Dec 1, 2016

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.
@davidfowl

This comment has been minimized.

Show comment
Hide comment
@davidfowl

davidfowl Dec 1, 2016

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?

Member

davidfowl commented Dec 1, 2016

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?

@emgarten

This comment has been minimized.

Show comment
Hide comment
@emgarten

emgarten Dec 1, 2016

Contributor

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.

Contributor

emgarten commented Dec 1, 2016

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.

@rrelyea rrelyea added this to the 4.0 RTM milestone Jan 16, 2017

@rrelyea rrelyea changed the title from ReadOnly PackageReference support to AutoReferenced PackageReference support Jan 25, 2017

@rrelyea rrelyea changed the title from AutoReferenced PackageReference support to AutoReferenced PackageReference support to block version changes in UI for "sdk installed" packages Jan 26, 2017

@emgarten emgarten referenced this issue in NuGet/NuGet.Client Jan 31, 2017

Closed

AutoReferenced support #1158

emgarten added a commit to NuGet/NuGet.Client that referenced this issue Feb 1, 2017

AutoReferenced support
PackageReferences with AutoReferenced set to true will no allow changes through the NuGet UI or console. These packages need to be updated separately.

Fixes NuGet/Home#4044

emgarten added a commit to NuGet/NuGet.Client that referenced this issue Feb 1, 2017

AutoReferenced support
PackageReferences with AutoReferenced set to true will no allow changes through the NuGet UI or console. These packages need to be updated separately.

Fixes NuGet/Home#4044

emgarten added a commit to NuGet/NuGet.Client that referenced this issue Feb 1, 2017

AutoReferenced support
PackageReferences with AutoReferenced set to true will no allow changes through the NuGet UI or console. These packages need to be updated separately.

Fixes NuGet/Home#4044

Addressing feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment