2015-05-04 7 views
13

Der unten eingefügte Fehler tritt nur auf, wenn die Lösung mehr als ein Projekt enthält, das auf EntityFramework verweist. Wenn er gestartet wird "Enable-Migrationen" oder "Add-Migration", erhielt ich folgende Fehlermeldung:Visual Studio 2015 RC Entity Framework 6.1.3 Migrationsfehler

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

Ausgang mit 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

FYI gibt es jetzt einen Workaround dafür - https://github.com/aspnet/EntityFramework/issues/1950#issuecomment-99343541 – CodingIntrigue

Antwort

12
+1

Ich musste den Inhalt des Skripts kopieren und einfügen, anstatt die Datei zu ersetzen, sonst erhalte ich einen Fehler Das Skript ist nicht digital signiert, sonst funktioniert das. Prost. – MIP1983

+2

@ MIP1983 Wenn Sie die Datei ersetzen, dann müssen Sie die Dateieigenschaften entsperren .. arbeitete für mich;) –

+2

Arbeitete wie ein Charme.Allerdings hatte ich immer noch ein anderes Problem mit dem EF-Laden, also musste ich das EF-Modul manuell laden über: 'Import-Module. \ Packages \ EntityFramework.6.1.3 \ tools \ EntityFramework.psm1' – parliament

1

ich das gleiche Problem :(

Meine Abhilfe ist:

  1. Herunterstufung Entity Framework v6.1.1 (zumindest die neue NuGet GUI macht (sehr einfach)
  2. Führen Sie den Befehl (z. B. Add-Migration ...) auf der Paketmanagerkonsole aus. Es scheint in dieser Version
  3. zu arbeiten
  4. Framework Entity v6.1.3 Upgrade-zurück
+0

Ich folgte alle Schritte, aber das Problem wurde nicht gelöst. Funktioniert nur, wenn Sie ein Projekt mit installiertem EntityFramework haben. Wenn Sie mehrere haben, nachdem Sie die genannten Schritte ausgeführt haben, nicht gelöst. Ich habe versucht, als Administrator ausgeführt, nicht aufgelöst. –

+0

Oh :(Ich habe auch mehrere Projekte mit EF in der Lösung installiert, ich habe das Downgrade nur für das Projekt durchgeführt, das die Migrationen enthält. Könnten Sie versuchen, das 'packages' Verzeichnis zu löschen und alle Pakete vorher komplett wiederherzustellen Ich habe das auch beim Herumspielen gemacht, aber ich dachte nicht, dass es meinem Workaround in irgendeiner Weise geholfen hat. –

1

scheint ein verbreitetes Problem zu sein, aber offenbar schwer zu Repo?

Enable-migrations error #1950

Schlagen Sie Ihr Problem Details zu dem oben in der Hoffnung, hinzufügen, dass es schnell gelöst werden kann.

+0

Hinzugefügt. Thanks. –

0

Ich habe eine temporäre Lösung gefunden: Kommentar <package id="EntityFramework" version="6.1.3" targetFramework="net46" userInstalled="true" /> von all seinen "packages.config" verlassen nur das Projekt, das Sie mit Migrationen arbeiten möchten unkommentiert.

Das Team EntityFramework (https://github.com/aspnet/EntityFramework/issues/1950) und NuGet (https://github.com/NuGet/Home/issues/528) sind sich des Problems bewusst und wir werden bald eine endgültige Lösung haben.

1

Wie in comment by yishaigalatzer auf EF Bug # 1950, NuGet 3.0 RC2 wurde jetzt veröffentlicht, die dieses Problem beheben sollte. Einfach den VSIX von codeplex herunterladen und installieren.

Dies löste das Problem für mich.