我试图从程序集创建一个NuGet包,它实际上是一个Cake Build插件。它引用了两个NuGet包:Cake.Core
和System.ValueTuple
,其他附加引用为System
和System.Core
。
.nuspec文件是使用nuget spec MyAddin.csproj
创建的,一切都应该很好。当我运行pack
命令时,我收到错误"无法加载文件或程序集&System; Collection.Collections.Immutable,Version = 1.2.1.0,..."。
我已经检查了dotPeek中的Cake.Core
和System.ValueTuple
,并且都没有引用System.Collections.Immutable
。
我可以从命令行构建没有问题的程序集。但不是NuGet包。我不明白发生了什么。
以下是完整输出:
PS C:\path\to\MyAddin> .\tools\nuget.exe pack .\MyAddin\MyAddin.csproj -verbo
sity detailed
NuGet Version: 4.3.0.4406
Attempting to build package from 'MyAddin.csproj'.
MSBuild auto-detection: using msbuild version '15.3.409.57025' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017
\Enterprise\MSBuild\15.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Could not load file or assembly 'System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f
11d50a3a' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Collections.Immutable, Version=1.2.1.0, Culture
=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Microsoft.Build.Evaluation.LazyItemEvaluator`4.ProcessItemElement(String rootDirectory, ProjectItemElement itemEle
ment, Boolean conditionResult)
at Microsoft.Build.Evaluation.Evaluator`4.EvaluateItemElement(Boolean itemGroupConditionResult, ProjectItemElement it
emElement, LazyItemEvaluator`4 lazyEvaluator)
at Microsoft.Build.Evaluation.Evaluator`4.EvaluateItemGroupElement(ProjectItemGroupElement itemGroupElement, LazyItem
Evaluator`4 lazyEvaluator)
at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(ILoggingService loggingService, BuildEventContext buildEventContex
t)
at Microsoft.Build.Evaluation.Project.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loa
dSettings)
at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadS
ettings loadSettings)
at Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subTools
etVersion, ProjectLoadSettings loadSettings)
at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion,
String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings)
at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
编辑:添加System.Collections.Immutable
v1.3.0 NuGet包,实际上是System.Collections.Immutable
程序集版本1.2.1,没有区别