EF6 migrations stopped working on VS 2015 RC

entity-framework-6 visual-studio-2015

Question

I've been using VS2015CTP now I decided to upgrade it to VS2015 Community RC For some unknown reason migrations on my projects stopped working.

In Visual Studio 2015 I get the following message>

PM> update-database
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 G:\Projects\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 G:\Projects\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 G:\Projects\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:809 char:5
+     $domain.CreateInstanceFrom(
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : PathTooLongException

PM> 

If I open the solution in VS 2013 and run the above command everything works fine. Is this some bug in VS, did it lose reference to something? Is there a way to activate some sort of more extensive log, I really don't feel into debug EF.

Thanks

Edit: I think this has something to do with the way Nuget is handled in Visual Studio 2015, it seems it doesn't look at nuget.config the same way. I have all the packages across several solutions in the same folder, to do this I use a nuget.config under .nuget folder with:

<config>
    <add key="repositoryPath" value="G:/Projects/packages" />
</config>

for some reason it seems that VS2015 is not handling this the same way as VS2013 because it tries to download the packages to the folder packages under the solution folder.

1
6
5/4/2015 5:13:32 PM

Accepted Answer

Downgraded the Entity Framework version from 6.1.3 to EF 6.1.2 and now it works.

https://github.com/aspnet/EntityFramework/issues/1950

5
5/4/2015 8:34:25 PM

Popular Answer

Issue stems from having multiple projects referencing EF.

None of the existing answers worked for me. The only way I could resolve was to unload all projects referencing EF other than the one I was running Update-Database on.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow