How does NuGet decide whether to use local package cache or not?

后端 未结 2 1395
慢半拍i
慢半拍i 2021-02-05 16:49

Today I\'ve faced with a strange behavior of NuGet when installing a package.

A brief description: as a result of my build script there\'s a NuGet package. I don\'t chan

相关标签:
2条回答
  • 2021-02-05 17:37

    Yan,

    NuGet caches the packages it downloads on your local hard drive. For my windows 7 machine the cache is located at C:\Users\jmelosegui\AppData\Local\NuGet\Cache. So you can delete the nuget package you want to forget from the local cache directory. Then the next time you install the package you will get the lastest version from the server.

    BTW: I am agree with @matthew-skelton.

    You should not be pushing more than one package with a particular version: packages should be immutable. If you've changed something in the package, increment the build number a.b.C and push a new version of the package.

    I hope this aproach fit in your scenario

    0 讨论(0)
  • 2021-02-05 17:42

    Yan,

    I push another update of MyPackage - still of version 1.0.0.

    You should not be pushing more than one package with a particular version: packages should be immutable. If you've changed something in the package, increment the build number a.b.C and push a new version of the package.

    The behaviour you experience is a side effect of NuGet expecting to be able to cache a given package version essentially indefinitely.

    0 讨论(0)
提交回复
热议问题