我不得不承认我对 ASP.NET vNext 如何处理依赖关系有点困惑。问题是我想将 Microsoft Sync Framework 与我在 ASP.NET 5 中实现的 API 一起使用。过去我曾经安装SDK,然后只引用适当的 dll。vNext 似乎并非如此,因为它在依赖关系方面都是包驱动的。因此,我在 NuGet 上找到了 Microsoft.SyncFramework 包,并将其作为依赖项添加到我的 ASP.NET vNext 项目中:
"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-beta1",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta1",
"Microsoft.AspNet.Mvc": "6.0.0-beta1"
},
"frameworks": {
"aspnet50": {
"dependencies": {
"Microsoft.SyncFramework": "2.1.0.2"
}
},
"aspnetcore50": { }
}
当 VS 尝试恢复包时,会出现以下错误:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Framework.Runtime.LibraryInformation..ctor(LibraryDescription description)
at Microsoft.Framework.Runtime.LibraryManager.<>c__DisplayClass2.<GetLibraryInfoThunk>b__7(LibraryDescription library)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at Microsoft.Framework.Runtime.LibraryManager.EnsureInitialized()
at Microsoft.Framework.Runtime.LibraryManager.GetLibraryInformation(String name, String aspect)
at Microsoft.Framework.Runtime.ProjectExportProviderHelper.GetExportsRecursive(ICache cache, ILibraryManager manager, ILibraryExportProvider libraryExportProvider, ILibraryKey target, Boolean dependenciesOnly)
at Microsoft.Framework.Runtime.LibraryManager.<>c__DisplayClass0.<GetAllExports>b__1(CacheContext ctx)
at Microsoft.Framework.Runtime.CacheExtensions.<>c__DisplayClass0`1.<Get>b__1(CacheContext ctx)
at Microsoft.Framework.Runtime.Cache.CreateEntry(Object k, Func`2 acquire)
at Microsoft.Framework.Runtime.Cache.<>c__DisplayClass3.<AddEntry>b__4()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at Microsoft.Framework.Runtime.Cache.Get(Object key, Func`2 factory)
at Microsoft.Framework.Runtime.CacheExtensions.Get[T](ICache cache, Object key, Func`2 factory)
at Microsoft.Framework.Runtime.LibraryManager.GetAllExports(String name, String aspect)
at Microsoft.Framework.Runtime.LibraryManager.GetAllExports(String name)
at Microsoft.Framework.Runtime.ProjectMetadataProvider.GetProjectMetadata(String name)
at Microsoft.Framework.DesignTimeHost.ApplicationContext.Initialize(String appPath, String configuration, Boolean triggerBuildOutputs)
at Microsoft.Framework.DesignTimeHost.ApplicationContext.Calculate()
at Microsoft.Framework.DesignTimeHost.ApplicationContext.DoProcessLoop()
at Microsoft.Framework.DesignTimeHost.ApplicationContext.ProcessLoop(Object state)
结果,我没有包含该软件包。
关于如何解决这个问题的任何想法?