Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EF6 migrations stopped working on VS 2015 RC

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.

like image 386
Rui Lima Avatar asked May 03 '15 22:05

Rui Lima


2 Answers

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

like image 120
Rui Lima Avatar answered Oct 05 '22 08:10

Rui Lima


Another reason can be in using EF in two or more projects (https://github.com/NuGet/Home/issues/528)

Temporary solution: Comment

<package id="EntityFramework" version="6.1.3" targetFramework="net46" userInstalled="true" /> 

of all its "packages.config" leaving uncommented only the project you want to work with Migrations.

like image 40
RouR Avatar answered Oct 05 '22 06:10

RouR