2015-05-04 20 views
13

L'errore riportato di seguito si verifica solo quando la soluzione ha più di un progetto che fa riferimento a EntityFramework. Quando viene eseguito il "Attiva-Migrazioni" o "Add-migrazione", ho ricevuto il seguente errore:Visual Studio 2015 Entity Framework RC 6.1.3 Errore di migrazione

New-Object : The value supplied is not valid, or the property is read-only. Change the value, and then try again. At D:\Projetos\Monitoramento\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:757 char:13 + $info = New-Object System.AppDomainSetup -Property @{ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [New-Object], Exception + FullyQualifiedErrorId : SetValueException,Microsoft.PowerShell.Commands.NewObjectCommand The property 'PrivateBinPath' cannot be found on this object. Verify that the property exists and can be set. At D:\Projetos\Monitoramento\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:772 char:9 + $info.PrivateBinPath += ';lib\net45' + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : PropertyNotFound Exception calling "LoadFrom" with "1" argument(s): "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters." At D:\Projetos\Monitoramento\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 char:5 + $utilityAssembly = [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsP ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : PathTooLongException You cannot call a method on a null-valued expression. At D:\Projetos\Monitoramento\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:781 char:5 + $dispatcher = $utilityAssembly.CreateInstance( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Exception calling "CreateInstanceFrom" with "8" argument(s): "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters." At D:\Projetos\Monitoramento\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:809 char:5 + $domain.CreateInstanceFrom( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : PathTooLongException

Uscita con EntityFramework 6.1.1:

Exception calling "LoadFrom" with "1" argument(s): "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters." At C:\Users\Hudson\Documents\Visual Studio 2015\Projects\WpfApplication4\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:780 char:5 + $utilityAssembly = [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsP ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : PathTooLongException You cannot call a method on a null-valued expression. At C:\Users\Hudson\Documents\Visual Studio 2015\Projects\WpfApplication4\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:781 char:5 + $dispatcher = $utilityAssembly.CreateInstance( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Exception calling "CreateInstanceFrom" with "8" argument(s): "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters." At C:\Users\Hudson\Documents\Visual Studio 2015\Projects\WpfApplication4\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:809 char:5 + $domain.CreateInstanceFrom( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : PathTooLongException

+0

Per ora c'è una soluzione per questo - https://github.com/aspnet/EntityFramework/issues/1950#issuecomment-99343541 – CodingIntrigue

risposta

12
+1

Ho dovuto copiare e incollare il contenuto dello script piuttosto che sostituire il file, altrimenti ricevo un errore che lo script non è firmato digitalmente, altrimenti ha funzionato, evviva – MIP1983

+2

@ MIP1983 se si sostituisce il file, quindi è necessario 'Sbloccare' dalle proprietà del file .. ha funzionato per me;) –

+2

Ha funzionato come un fascino.Tuttavia, avevo ancora qualche problema con il caricamento di EF in primo luogo, quindi ho dovuto caricare manualmente il modulo EF tramite: 'Import-Module. \ Packages \ EntityFramework.6.1.3 \ tools \ EntityFramework.psm1' – parliament

1

Ho lo stesso problema :(

la mia soluzione è:

  1. Downgrade Entity Framework a v6.1.1 (almeno la nuova interfaccia grafica rende NuGet molto semplice)
  2. Eseguire il comando (ad esempio Add-Migration ...) sulla console del gestore pacchetti. Sembra funzionare in questa versione
  3. Aggiorna torna a Entity Framework V6.1.3
+0

Ho seguito tutti i passaggi, ma il problema non è stato risolto. Funziona solo se hai un progetto con EntityFramework installato. Se ne hai più di uno, dopo aver seguito i passaggi indicati, non risolto. Ho provato a eseguire come amministratore, non risolto. –

+0

Oh :(Anch'io ho diversi progetti con EF installati nella soluzione, ho eseguito il downgrade solo sul progetto che contiene le migrazioni. Potresti provare ad eliminare la directory 'packages' e ripristinare completamente tutti i pacchetti in anticipo. fatto ciò mentre suonava in giro, ma non pensavo che mi aiutasse in alcun modo: –

1

sembra essere un problema comune, ma a quanto pare difficile da pronti contro termine?

Enable-migrations error #1950

suggerisco di aggiungere i dati di emissione a quanto sopra, nella speranza che possa essere risolto rapidamente.

+0

Aggiunto. Grazie –

0

Ho trovato una soluzione temporanea: Commento <package id="EntityFramework" version="6.1.3" targetFramework="net46" userInstalled="true" /> di tutti i suoi "pacchetti.config" lasciando senza commento solo il progetto che si desidera utilizzare con Migrazioni.

Team EntityFramework (https://github.com/aspnet/EntityFramework/issues/1950) e NuGet (https://github.com/NuGet/Home/issues/528) sono a conoscenza del problema e presto avremo una soluzione definitiva.

1

Come da comment by yishaigalatzer su bug EF # 1950, è stato rilasciato NuGet 3.0 RC2, che dovrebbe risolvere questo problema. Basta scaricare VSIX da codeplex e installarlo.

Questo ha risolto il problema per me.

Problemi correlati