Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PackageReference support for msbuild variables #6108

Closed
asklar opened this issue Feb 2, 2021 · 3 comments
Closed

PackageReference support for msbuild variables #6108

asklar opened this issue Feb 2, 2021 · 3 comments
Labels
needs-triage Have yet to determine what bucket this goes in.

Comments

@asklar
Copy link
Contributor

asklar commented Feb 2, 2021

https://github.com/NuGet/docs.microsoft.com-nuget/blob/master/docs/consume-packages/Package-References-in-Project-Files.md#adding-a-packagereference-condition

This doc mentions that one can use Conditions in PackageReferences, but then later it says this only works for targetFramework.

In my scenario I need the ability to bring in one of two possible nuget packages into my csproj, depending on an msbuild variable (different versions of a package). However when I try to use the variable in the condition, VS seems to always include both packages, which obviously isn't what I need.

Is there a way to achieve this? If not, can this issue be turned into a feature request :)

@asklar asklar added bug needs-triage Have yet to determine what bucket this goes in. labels Feb 2, 2021
@benvillalobos
Copy link
Member

Team Triage: You can create a property within your project, something like $(NewtonsoftJsonVersion) and set that based off of a condition. Then in your packagereference, use that as your version.

Is this what you needed?

@benvillalobos benvillalobos removed the bug label Feb 3, 2021
@rainersigwald
Copy link
Member

This is a feature request, but for NuGet. I'll duplicate it to their bug.

@rainersigwald
Copy link
Member

Duplicate of NuGet/Home#5895

@rainersigwald rainersigwald marked this as a duplicate of NuGet/Home#5895 May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Have yet to determine what bucket this goes in.
Projects
None yet
Development

No branches or pull requests

3 participants