How to pin a package and prevent from accidentally updating? #13187
Unanswered
darthkurak
asked this question in
Q&A
Replies: 2 comments
-
Im also wondering about this myself |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'd like this too. In the meantime, I hacked together this approach: Add something along the lines of the following to your Directory.Packages.props <Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="SomeLibrary" Version="1.2.3" />
...
</ItemGroup
...
<Target Name="CheckPackageVersion" BeforeTargets="Build">
<Error Condition="'%(PackageVersion.Identity)' == 'SomeLibrary' AND '%(PackageVersion.Version)' != '1.1.1'" Text="Invalid package version for SomeLibrary. Expected: 1.1.1." />
</Target>
</Project> It should fail to build because e.g., SomeLibrary 1.2.3 != 1.1.1. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! I am trying to pin a package in my CPM "Directory.Packages.props" file.
I did for example
<PackageVersion Include="Azure.Core" Version="[1.36.0]" />
BUT,
dotnet add package 1.37.0 - will change it to 1.37.0, and i will get only warning NU1608.
Also, the Rider Nuget manager seems to ignore this and shows me an update, and when updating - changes the version.
Am I doing something wrong?
How actually in Nuget world, having CPM, i can pin some package and prevent it from accidentally updating?
Beta Was this translation helpful? Give feedback.
All reactions