1

我不得不承認我對ASP.NET vNext如何處理依賴關係有點困惑。問題是我想用我在ASP.NET 5中實現的API來使用Microsoft Sync Framework。過去,我曾經安裝the SDK,然後引用適當的dll。看來,vNext並非如此,因爲它涉及到依賴關係時所有的軟件包驅動。因此,我發現Microsoft.SyncFramework package on NuGet並將其添加爲我的ASP.NET vNext項目的依賴關係:將NuGet包添加到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) 

而作爲結果我沒有包括在內。

有關如何解決此問題的任何想法?

+0

我還沒有嘗試我的同步框架的NuGet與vNext包裝出來的機會運行*的.ps1腳本但因爲我沒有vNext環境。然而,我可以檢查一下,你是否嘗試過使用包管理器控制檯「install-package Microsoft.syncframework」來安裝軟件包,並獲得與通過UI相同的結果? – Darrell

+0

您是否嘗試列出「依賴關係」下的依賴關係而不是框架?即: 「依賴性」:{ 「Microsoft.AspNet.Server.IIS」:「1.0.0-beta1」, 「Microsoft.AspNet.Diagnostics」:「1.0.0-beta1」, 「Microsoft.AspNet .Mvc「:」6.0.0-beta1「, 」Microsoft.SyncFramework「:」2.1.0.2「 }, – Darrell

+0

@Darrell是的,我確實嘗試了你提到的所有事情。部分問題是vNext不支持NuGet包中的* .msi(ps1文件在安裝包時不運行),我們是否應該爲SyncFramework創建另一個僅包含dll(從.msi安裝的)的包? – rafek

回答

相關問題