将NuGet包添加到ASP.NET vNext项目时出错

时间:2015-01-04 05:21:07

标签: nuget dependency-management asp.net-core nuget-package-restore

我承认我对ASP.NET vNext如何处理依赖项有点困惑。问题是,我想将Microsoft Sync Framework与我在ASP.NET 5中实现的API一起使用。回到过去,我曾经安装the SDK,然后只引用适当的dll。似乎vNext不是这种情况,因为它涉及到依赖关系时所有的包驱动。因此,我发现Microsoft.SyncFramework package on 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)

因此我没有收到包裹。

关于如何解决这个问题的任何想法?

1 个答案:

答案 0 :(得分:1)

显然,ASP.NET vNext不再支持在NuGet包中运行* .ps1脚本http://forums.asp.net/p/2027698/5842272.aspx