我刚刚安装了WebMatrix 3.0。当我单击功能区上的NuGet扩展以加载某些扩展时,我收到一条错误消息,指出安装的NuGret版本(2.2显然)与.Net.Http dll的版本不兼容。我已经尝试通过扩展管理器升级NuGet,但似乎没有办法做到这一点 - 只有一个禁用和卸载选项。关于这里发生了什么的任何想法?为什么与WebMatrix 3.0一起安装了不兼容的NuGet版本?
包含堆栈跟踪的错误消息如下:
An error occurred.
The schema version of 'Microsoft.Net.Http' is incompatible with version 2.2.31210.9045 of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942.
System.InvalidOperationException: The schema version of 'Microsoft.Net.Http' is incompatible with version 2.2.31210.9045 of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942.
at NuGet.Manifest.CheckSchemaVersion(XDocument document)
at NuGet.Manifest.ValidateManifestSchema(XDocument document, String schemaNamespace)
at NuGet.Manifest.ReadFrom(Stream stream, IPropertyProvider propertyProvider)
at NuGet.LocalPackage.ReadManifest(Stream manifestStream)
at NuGet.ZipPackage.EnsureManifest()
at NuGet.ZipPackage..ctor(Func`1 streamFactory, Boolean enableCaching)
at NuGet.PackageDownloader.DownloadPackage(IHttpClient downloadClient, IPackageMetadata package)
at NuGet.PackageDownloader.DownloadPackage(Uri uri, IPackageMetadata package)
at NuGet.DataServicePackage.EnsurePackage(IPackageRepository cacheRepository)
at NuGet.DataServicePackage.GetSupportedFrameworks()
at NuGet.PackageRepositoryExtensions.<>c__DisplayClass2e.<SupportsTargetFrameworks>b__2d(FrameworkName t)
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
at NuGet.PackageRepositoryExtensions.SupportsTargetFrameworks(IEnumerable`1 targetFramework, IPackage package)
at NuGet.PackageRepositoryExtensions.<>c__DisplayClass2b.<GetUpdatesCore>b__26(<>f__AnonymousType19`2 <>h__TransparentIdentifier22)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.GroupedEnumerable`3.GetEnumerator()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at Microsoft.WebMatrix.NuGet.FilterManager.AddPackagesToFilter(ListViewFilter filter, IEnumerable`1 packages, PackageViewModelAction packageAction)
at Microsoft.WebMatrix.NuGet.FilterManager.<>c__DisplayClass7.<UpdateFilterWithResult>b__6(Task`1 task)
at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
答案 0 :(得分:2)
我刚遇到同样的错误消息。解决方案是清除NuGet包缓存并重试。
有关如何清除NuGet包缓存here的更多信息。
答案 1 :(得分:2)
为了解决这个问题,我指出了官方https://nuget.org/api/v2来源。
执行以下操作:
这将消除错误。