vendredi 26 février 2016

ASP.NET 5: kpm can't locate EntityFramework.Sqlite and Microsoft.Data.Sqlite packages

I'm trying to use SQLite in an ASP.NET 5 website, but I'm having trouble with EntityFramework.Sqlite and Microsoft.Data.Sqlite packages. The kpm restore command is giving me:

C:\Users\jerom\Documents\Visual Studio 2015\Projects\TongyiFapiao\src\TongyiFapiao>kpm restore
Restoring packages for C:\Users\jerom\Documents\Visual Studio 2015\Projects\TongyiFapiao\src\TongyiFapiao\project.json
GET http://ift.tt/1WNAucS'EntityFramework.Sqlite'.
GET http://ift.tt/1WNAucS'Microsoft.Data.Sqlite'.
OK http://ift.tt/1WNAucS'Microsoft.Data.Sqlite' 1228ms
OK http://ift.tt/1WNAucS'EntityFramework.Sqlite' 1262ms
The XML file C:\Users\jerom\AppData\Local\kpm\cache\ca78217dc80ed627f4567234a39c90ac05cda559$s_api.nuget.org_v3_index.json_\list_Microsoft.Data.Sqlite_page1.dat is corrupt
Warning: FindPackagesById: Microsoft.Data.Sqlite
Data at the root level is invalid. Line 1, position 1.
GET http://ift.tt/1WNAucS'Microsoft.Data.Sqlite'.
The XML file C:\Users\jerom\AppData\Local\kpm\cache\ca78217dc80ed627f4567234a39c90ac05cda559$s_api.nuget.org_v3_index.json_\list_EntityFramework.Sqlite_page1.dat is corrupt
Warning: FindPackagesById: EntityFramework.Sqlite
Data at the root level is invalid. Line 1, position 1.
GET http://ift.tt/1WNAucS'EntityFramework.Sqlite'.
OK http://ift.tt/1WNAucS'Microsoft.Data.Sqlite' 50ms
The XML file C:\Users\jerom\AppData\Local\Temp\tmpC325.tmp is corrupt
Warning: FindPackagesById: Microsoft.Data.Sqlite
Data at the root level is invalid. Line 1, position 1.
GET http://ift.tt/1WNAucS'Microsoft.Data.Sqlite'.
OK http://ift.tt/1WNAucS'EntityFramework.Sqlite' 50ms
The XML file C:\Users\jerom\AppData\Local\Temp\tmpC347.tmp is corrupt
Warning: FindPackagesById: EntityFramework.Sqlite
Data at the root level is invalid. Line 1, position 1.
GET http://ift.tt/1WNAucS'EntityFramework.Sqlite'.
OK http://ift.tt/1WNAucS'Microsoft.Data.Sqlite' 48ms
The XML file C:\Users\jerom\AppData\Local\Temp\tmpC368.tmp is corrupt
Error: FindPackagesById: Microsoft.Data.Sqlite
Data at the root level is invalid. Line 1, position 1.
----------
OK http://ift.tt/1WNAucS'EntityFramework.Sqlite' 50ms
The XML file C:\Users\jerom\AppData\Local\Temp\tmpC37A.tmp is corrupt
System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at System.Xml.Linq.XDocument.Load(Stream stream, LoadOptions options)
at System.Xml.Linq.XDocument.Load(Stream stream)
at Microsoft.Framework.PackageManager.Restore.NuGet.NuGetv2Feed.<FindPackagesByIdAsyncCore>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Framework.PackageManager.RemoteWalkProvider.<FindLibrary>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Framework.PackageManager.RestoreOperations.<FindLibrary>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.Framework.PackageManager.RestoreOperations.<FindLibraryByVersion>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.Framework.PackageManager.RestoreOperations.<FindLibraryMatch>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Framework.PackageManager.RestoreOperations.<FindLibraryEntry>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Framework.PackageManager.RestoreOperations.<CreateGraphNode>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.Framework.PackageManager.RestoreOperations.<CreateGraphNode>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.Framework.PackageManager.RestoreCommand.<RestoreForProject>d__62.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Framework.PackageManager.RestoreCommand.<ExecuteCommand>d__61.MoveNext()
Error: FindPackagesById: EntityFramework.Sqlite
Data at the root level is invalid. Line 1, position 1.
----------
Restore failed
Data at the root level is invalid. Line 1, position 1.

and kpm build gives me also:

Unable to resolve dependency EntityFramework.Sqlite 7.0.0-rc1-final
Unable to resolve dependency Microsoft.Data.Sqlite 1.0.0-rc1-final

However it's working perfectly well when I build from Visual studio, taking the packages from my .dnx\packages directory:

Using Package dependency EntityFramework.Sqlite 7.0.0-rc1-final
Source: C:\Users\jerom\.dnx\packages\EntityFramework.Sqlite\7.0.0-rc1-final
File: lib\net451\EntityFramework.Sqlite.dll
Using Package dependency Microsoft.Data.Sqlite 1.0.0-rc1-final 3>     
Source: C:\Users\jerom\.dnx\packages\Microsoft.Data.Sqlite\1.0.0-rc1-final
File: lib\net451\Microsoft.Data.Sqlite.dll

If I use the --packages option with the kpm restore command it, seems to work:

kpm restore --packages C:\Users\jerom\.dnx\packages
Restoring packages for C:\Users\jerom\Documents\Visual Studio 2015\Projects\TongyiFapiao\src\TongyiFapiao\project.json
Resolving complete, 732ms elapsed
Restore complete, 738ms elapsed

But at the end, it fails when I execute

k ef migration add initial
k ef migration apply

Here is my project.json file:

{
    "version": "1.0.0-*",
    "compilationOptions": {
    "emitEntryPoint": true
},
"dependencies": {
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "TongyiFapiao.Models": "1.0.0-*",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "EntityFramework.Sqlite": "7.0.0-rc1-final",
    "EntityFramework.Relational": "7.0.0-rc1-final",
    "Microsoft.Data.Sqlite": "1.0.0-rc1-final",
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "System.Data.SQLite": "1.0.99",
    "TongyiFapiao.DAL": "1.0.0-*",
    "Microsoft.Framework.Configuration.Json": "1.0.0-beta8"
},
"commands": {
    "web": "Microsoft.AspNet.Server.Kestrel",
    "ef": "EntityFramework.Commands"
},
"frameworks": {
    "dnx451": {
        "dependencies": {
        "TongyiFapiao.DAL": "1.0.0-*"
    }
 },
 "dnxcore50": {
 }
},
"exclude": [
  "wwwroot",
  "node_modules"
],
"publishExclude": [
   "**.user",
   "**.vspscc"
]
}

I've tried to modify the Nuget.config file to use different Nuget repositories but none of them are working. I also upgraded my KVM and DNVM and here are all the .NET versions installed:

C:\Users\jerom\Documents\Visual Studio 2015\Projects\TongyiFapiao\src\TongyiFapiao>dnvm list
WARNING: Found a KRE_HOME environment variable. This variable has been deprecated and should be removed, or it may interfere with DNVM and the .NET Execution environment
Active Version           Runtime Architecture OperatingSystem Alias
------ -------           ------- ------------ --------------- -----
   1.0.0-beta5       clr     x64          win
   1.0.0-beta5       clr     x86          win
   1.0.0-beta5       coreclr x64          win
   1.0.0-beta5       coreclr x86          win
   1.0.0-beta8-15736 clr     x86          win
   1.0.0-rc1-final   clr     x64          win
   1.0.0-rc1-final   clr     x86          win
   1.0.0-rc1-final   coreclr x64          win
   1.0.0-rc1-final   coreclr x86          win
   1.0.0-rc1-update1 clr     x64          win
  *1.0.0-rc1-update1 clr     x86          win             default
   1.0.0-rc1-update1 coreclr x64          win
   1.0.0-rc1-update1 coreclr x86          win

I've tried to change to the different versions of update 1 but still the same problem. Thanks for your help

Aucun commentaire:

Enregistrer un commentaire