1
votes

I've to admit I'm a little bit confused with how ASP.NET vNext handles dependencies. The thing is that I'd like to use Microsoft Sync Framework with an API I'm implementing in ASP.NET 5. Back in the past I used to install the SDK and then just reference appropriate dlls. It seems that it's not the case with vNext as it's all package driven when it comes to dependencies. Thus I've found Microsoft.SyncFramework package on NuGet and added it as a dependency in my ASP.NET vNext project:

"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": { }
}

And when VS tries to restore the package, it gets this error:

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)

And as a result I don't have the package included.

Any ideas on how to tackle this?

1
I haven't had the chance to try my sync framework nuget package out with vNext yet as I don't have a vNext environment. However can I just check, have you tried installing the package using the package manager console "install-package Microsoft.syncframework" and do you get the same result as via the UI?Darrell
Have you tried listing the dependency under "dependencies" rather than frameworks? i.e: "dependencies": { "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
@Darrell yes, I did try all of them things you've mentioned. Part of the problem is that vNext doesn't support *.msi in NuGet packages (ps1 files aren't run while installing packages), should we create another packages for SyncFramework that include only dlls (that are installed from .msi)?rafek
hmm that will be a problem then. I tried creating a package that only contains the dll's, however if the sync framework msi is not also installed onto the developers machine, then the sync framework assemblies won't function - so if we did this we would also have to add the caveat that the developer still needs to install the sync framework msi on their machine otherwise thing's won't work.. The beauty of including the msi was that it saved developers that extra manual step.Darrell
I can't think of any other way as you can't reference dlls in vNext - dependencies are handled only through NuGet..rafek

1 Answers

1
votes

Apparently ASP.NET vNext dropped support for running *.ps1 scripts in NuGet packages http://forums.asp.net/p/2027698/5842272.aspx