Nuget似乎安装了错误版本的System.Collections.Immutable

bra*_*ing 9 c# nuget immutable-collections

我和Nuget有一个令人困惑的问题.我有很多项目声称在1.3.0版本上安装了System.Collections.Immutable 但是如果我在所有引用中看到dll的版本,我看到版本1.2.1.0

当我用JustDecompile打开DLL时,我看到了 在此输入图像描述 它声明DLL版本确实是1.2.1.0但已安装在目录包\ System.Collections.Immutable.1.3.0中

典型的packages.config文件将包含

<package id="System.Collections.Immutable" version="1.3.0" targetFramework="net452" />
Run Code Online (Sandbox Code Playgroud)

和csproj是

<Reference 
  Include="System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\System.Collections.Immutable.1.3.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
  <Private>True</Private>
</Reference>
Run Code Online (Sandbox Code Playgroud)

如果我尝试从库中打开下载的nuget包并使用nuget package explorer打开,我会得到

在此输入图像描述

Mat*_*ard 3

NuGet 包版本和程序集版本不一定相同。对于两者中使用的版本都没有限制。

因此,查看 System.Collections.Immutable 1.3.0,NuGet 包中的程序集的程序集版本为 1.2.1.0。

如果无法在 NuGet Package Explorer 中打开 NuGet 包,可以在 zip 文件应用程序(例如 7-zip)中打开它。或者只需将文件重命名为 .zip 并使用内置的 Windows zip 文件提取器将其打开。