“The specified path, file name, or both are too long.” Error (Entity Framework 6.1 and Visual Studio 2015)

This is an issue a coworker of mine ran across the other day while trying to run “Update-Database” on his EF6 project via Visual Studio 2015. Specifically, this error only seems to occur when referencing the EntityFramework NuGet package in more than one project in the same solution.

This issue appears to affect any command related to migrations, and is due to a NuGet bug in Visual Studio 2015 wherein enumerating packages will cause some packages to be returned multiple times. This only seems to affect VS2015RC, and can be fixed in one of two ways:

1st Way to Fix

  1. Download this patched version of EntityFramework.psm1, and copy it into the packages\EntityFramework.{version}\tools folder under the solution directory.
  2. Restart Visual Studio once you’ve done this.

This script isn’t signed, so you may need to unblock it in Explorer and run “Set-ExecutionPolice Unrestricted”

2nd Way to Fix

Upgrade to NuGet 3.0 RC2, which fixes the package listing duplication issue.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s