I'm using ServiceStack but I could not buy paid version of it, so I dont want to see newer version of it in my package update list.
I'm using TwitterBootstrap but our theme is compatible with 2.x version of TwitterBootstrap so I dont want to see 3.x version of it Bootstrap in my package update list.
So how can i prevent update notifications for specific packages in Nuget Package Manager
You can use an allowedVersions constraint in your packages.config file for all the packages you want to fix to a particular version.
<package id="ServiceStack" version="3.9.60" targetFramework="net45" allowedVersions="[3.9.6]"/>
With the above in place the Manage Packages dialog will not show any updates for ServiceStack. You will need to add the allowedVersions attribute to all the service stack NuGet packages.
The Package Manager Console will show updates if you use
Get-Package -Updates
However it will not install anything due to the constraints:
Update-Package
Applying constraint 'ServiceStack (= 3.9.6)' defined in packages.config.
No updates available for 'ServiceStack' in project 'MyApp'.
Related
In one of my projects I use AutoFixture.AutoMoq package which depends on Moq package
<!-- project1.csproj -->
<PackageReference Include="AutoFixture.AutoMoq">
<Version>4.11.0</Version>
</PackageReference>
and in another project I use Moq package directly, i.e.
<!-- project2.csproj -->
<PackageReference Include="Moq">
<Version>4.13.1</Version>
</PackageReference>
The problem is that Visual Studio / MSBuild / Nuget during package version resolution always selects minimal dependency i.e. Moq 4.1.1308.2120 but I would like to use latest version of Moq 4.13.1.
How to tell Visual Studio / nuget to explicitly use requested version ?
UPDATE:
When I try to set Dependency behavior to Highest in Nuget UI I got a message that it doesn't apply to projects using PackageReference approach:
How to tell Visual Studio / nuget to explicitly use requested version
?
It actually can be done. You should change Dependency behavior to Highest under NuGet Package Manager UI which means it will install all the latest version of the dependencies within the required version range.
Note that all of these are implemented within the scope of the dependencies specified by the package. Moq (>= 4.1.1308.2120 && < 5.0.0)
Solution
Right-click on your project-->Manage Nuget packages-->change Dependency behavior to Highest under Options in the area shown in the image above.
Update 1
Sorry for that this function(the same as use DependencyVersion highest) applies to packages.config format rather than PackageReference. And this option only supports packages.config format. See this link. When you use PackageReference foramt, it will ignore this option.
Besides, there is also a similar issue which have been discussing it for a long time and still occurs in the latest VS version.
Due to it, I have reported this issue in our DC Forum and you can vote for it or add any comments in this link if l miss some other detailed info. Anyone who is interested in this will vote it so that it will get Microsoft's attention as soon as possible.
So it cannot be achieved in one step.
As a suggestion, you should use two steps to release it. First, clean nuget caches first.
Install the latest version Moq 4.13.1, and then install the nuget package AutoFixture.AutoMoq 4.11.0.
Currently NuGet doesn't offer any way to control the versions used for transitive dependencies. There is a proposal in progress which will address the scenario.
By adding the PackageReference to Moq directly (even though it's already implied), you'll be able to pin the version as it's now a primary dependency.
installed api package version 24.2.0 via nuget in visual studio, still does not find api version v201809
get-package doesn't show any conflicting packages, so im not sure why this isnt showing up when I try to include it.
use nuget to remove package (uninstall-package google.adwords)
manually look at and remove references
check project settings and make sure framework target > 4.5.2
install package (install-package google.adwords)
I have a Xamarin iOS project that used to, but no longer compiles.
The same code, same component and nuget package references no longer compiles.
The error messages are like:
The type or namespace 'xamarin' could not be found. Are you missing an assembly reference?
(Yes, it cannot find Xamarin. I've also had this with Google.Maps and Newtonsoft.Json).
Xamarin studio shows packages with updates available. If I choose to update the package, the build progresses a bit further (or complains about a different missing library).
I don't want to update the packages. The ones we are using are stable for our use and known good.
How do I tell Xamarin Studio that I don't want to update, and in fact, I'd like to continue to use the version that's known to work?
Thanks
How do I tell Xamarin Studio that I don't want to update, and in fact, I'd like to continue to use the version that's known to work?
The simplest approach is to do nothing. Xamarin Studio will not automatically update your NuGet packages. You need to trigger the update yourself.
You can also disable the checking for NuGet package updates in Preferences - NuGet - General.
Finally if you want to make sure that the NuGet packages are not updated then you can put restriction in the packages.config file:
<packages>
<package id="SomePackage" version="2.1.0" allowedVersions="[2,3)" />
</packages>
There is more information on the supported allowedVersions syntax on the NuGet site
However all the above will not fix your build errors if you are getting an error without modifying the NuGet packages.
As the title says, I'd like to know if there is a way to automatically update an installed NuGet package as soon as a new version becomes available in the package source.
The use case is a package that applies certain company policies (code analysis, signing, ...) to our projects, and as soon as this package is updated, I'd like to be able to configure an automatic update for this package.
I do know that there is a package restore feature for NuGet which will automatically download the missing packages when the project is built, but does this download a specific version or the most recent package with a matching name?
Although coming late to the party, I would like to add, that updating NuGet packages may be possible with PackageReference.
See https://learn.microsoft.com/de-de/nuget/reference/package-versioning.
The NuGet package restore feature intentionally only works for one specific version. The same package with a different version number will not be used if the package with a lower version is missing.
Example 1
packages.config references 1.0.0.0
package source contains 1.0.0.0 and 1.0.0.1
1.0.0.0 is the version that will automatically be restored
Example 2
packages.config references 1.0.0.0
package source contains only 1.0.0.1
no automatic restore will be performed, the project won't build
This behaviour makes sense as otherwise there is no way to control what you are actually building. Imagine someone updates the package source with a newer version of a package just before you build a release that will get shipped...
This has only just started happening to me, and I'm not sure why.
I simply can't seem to find some nuget packages that I know are on the official feed.
For example: AutoMapper.
This is the package that I'm trying to add: https://www.nuget.org/packages/AutoMapper/3.0.0
Running Install-Package AutoMapper -Version 3.0.0 in the package manager console tells me that no such package could be found
Searching for AutoMapper in the Manage NuGet Packages window only returns a prerelease version (3.3.0-ci1017)
The URL I have for the feed is https://www.nuget.org/api/v2/.
Does anyone have any ideas as to what may be causing this?
You have likely changed NuGet to Include Prerelease packages. Just change the dropdown back to Stable Only.