How can I install an older version of a package via NuGet?

前端 未结 5 1844

I want to install an older version of a package (Newtonsoft.Json). But NuGet rolls back:

PM> Install-Package Newtonsoft.Json -Version 4.0.5
Su         


        
5条回答
  •  渐次进展
    2020-11-27 09:48

    As of NuGet 2.8, there is a feature to downgrade a package.

    NuGet 2.8 Release Notes

    Example:

    The following command entered into the Package Manager Console will downgrade the Couchbase client to version 1.3.1.0.

    Update-Package CouchbaseNetClient -Version 1.3.1.0
    

    Result:

    Updating 'CouchbaseNetClient' from version '1.3.3' to '1.3.1.0' in project [project name].
    Removing 'CouchbaseNetClient 1.3.3' from [project name].
    Successfully removed 'CouchbaseNetClient 1.3.3' from [project name].
    

    Something to note as per crimbo below:

    This approach doesn't work for downgrading from one prerelease version to other prerelease version - it only works for downgrading to a release version

提交回复
热议问题