New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable-migrations error #1950

Closed
613038475 opened this Issue Mar 30, 2015 · 51 comments

Comments

Projects
None yet
@613038475

613038475 commented Mar 30, 2015

When executing migrations commands such as Enable-Migrations, Add-Migration, etc. the following error is encountered.

Exception calling "LoadFrom" with "1" argument(s): "The specified path, file name, or both are too long. The fully qualified file name must be les
s than 260 characters, and the directory name must be less than 248 characters."

The issue is due to a NuGet bug which is tracked by NuGet/Home#528.

🌟 Workarounds 🌟

  • ⭐️ Install an updated NuGet client that resolves this issue https://nuget.codeplex.com/releases/view/615507
  • As a workaround, you can download this patched version of EntityFramework.psm1, copy it into the packages\EntityFramework.6.1.3\tools directory, restart Visual Studio, and try again.
  • An alternate workaround is to unload other projects that reference Entity Framework (so that the only loaded project that references Entity Framework is the one that contains your EF model).

Details

Full details of the error are...

Exception calling "LoadFrom" with "1" argument(s): "The specified path, file name, or both are too long. The fully qualified file name must be les
s than 260 characters, and the directory name must be less than 248 characters."
At D:\helloworld\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:\helloworld\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 m
ust be less than 260 characters, and the directory name must be less than 248 characters."
At D:\helloworld\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:809 char:5
+     $domain.CreateInstanceFrom(
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : PathTooLongException

No path is longer than 200 on my harddisk, so I can't understand why this problem will happen.

@rowanmiller rowanmiller added this to the Investigation milestone Mar 30, 2015

@mrchief

This comment has been minimized.

Show comment
Hide comment
@mrchief

mrchief May 1, 2015

This also happens when I tried to upgrade from 6.1.1 -> 6.1.3. I even moved my git repo to c: to gain few extra chars but to no avail.

mrchief commented May 1, 2015

This also happens when I tried to upgrade from 6.1.1 -> 6.1.3. I even moved my git repo to c: to gain few extra chars but to no avail.

@mrchief

This comment has been minimized.

Show comment
Hide comment
@mrchief

mrchief May 1, 2015

This seems to happen only in VS 2015 (RC) which makes me believe its more of a new NuGet issue. VS 2013 (Update 4) doesn't have this. Installation went fine. And Enable-Migrations also seem to be working fine.

mrchief commented May 1, 2015

This seems to happen only in VS 2015 (RC) which makes me believe its more of a new NuGet issue. VS 2013 (Update 4) doesn't have this. Installation went fine. And Enable-Migrations also seem to be working fine.

@NooNameR

This comment has been minimized.

Show comment
Hide comment
@NooNameR

NooNameR May 2, 2015

if create new project, all are fine, with my which worked in VS2013, in VS2015RC same error.

NooNameR commented May 2, 2015

if create new project, all are fine, with my which worked in VS2013, in VS2015RC same error.

@unt1tled

This comment has been minimized.

Show comment
Hide comment
@unt1tled

unt1tled May 4, 2015

Same issue here.

unt1tled commented May 4, 2015

Same issue here.

@divega

This comment has been minimized.

Show comment
Hide comment
@divega

divega May 5, 2015

Member

Everyone, thanks for reporting this.

It seems we'll need more details to be able to repro and forward the information to the NuGet folks, E.g. was yours a clean setup of Visual Studio 2015 RC or an upgrade form a previous preview?

cc @yishaigalatzer

Member

divega commented May 5, 2015

Everyone, thanks for reporting this.

It seems we'll need more details to be able to repro and forward the information to the NuGet folks, E.g. was yours a clean setup of Visual Studio 2015 RC or an upgrade form a previous preview?

cc @yishaigalatzer

@unt1tled

This comment has been minimized.

Show comment
Hide comment
@unt1tled

unt1tled May 5, 2015

I had uninstalled CTP 6 to install the 2015 RC. Windows 10 Preview, Build 10074

Also tried to no avail:

Works from VS 2013. Going to test it on a different machine.

Edit: Same result on different machine. Clean install.

unt1tled commented May 5, 2015

I had uninstalled CTP 6 to install the 2015 RC. Windows 10 Preview, Build 10074

Also tried to no avail:

Works from VS 2013. Going to test it on a different machine.

Edit: Same result on different machine. Clean install.

@brendangreen

This comment has been minimized.

Show comment
Hide comment
@brendangreen

brendangreen May 5, 2015

@divega

Having same issue, in multiple environments.

  1. Windows 10 Preview, Build 10074, where VS 2015 was initially the CTP and upgraded all the way to the RC.
  2. Windows 8.1, where VS 2015 RC was installed clean, with VS 2013 also present on the machine.

Solution was targeting .net 4.5.1, and I also changed it to 4.6, did not resolve the issue.

The project was using Entity Framework 6.1.3, but I have also tried downgrading to 6.1.2, 6.1.1 and 6.1.0 (to at least add a migration to the project) but I continue to get the same error.

Error from running Add-Migration:

New-Object : The value supplied is not valid, or the property is read-only. Change the value, and then try again.
At C:\Users\bgreen\Source\Paygle\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 C:\Users\bgreen\Source\Paygle\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 C:\Users\bgreen\Source\Paygle\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 C:\Users\bgreen\Source\Paygle\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 C:\Users\bgreen\Source\Paygle\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:809 char:5

  • $domain.CreateInstanceFrom(
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : PathTooLongException

Downgrading to VS 2013 is not an option if your project makes use of C# 6 features either.

brendangreen commented May 5, 2015

@divega

Having same issue, in multiple environments.

  1. Windows 10 Preview, Build 10074, where VS 2015 was initially the CTP and upgraded all the way to the RC.
  2. Windows 8.1, where VS 2015 RC was installed clean, with VS 2013 also present on the machine.

Solution was targeting .net 4.5.1, and I also changed it to 4.6, did not resolve the issue.

The project was using Entity Framework 6.1.3, but I have also tried downgrading to 6.1.2, 6.1.1 and 6.1.0 (to at least add a migration to the project) but I continue to get the same error.

Error from running Add-Migration:

New-Object : The value supplied is not valid, or the property is read-only. Change the value, and then try again.
At C:\Users\bgreen\Source\Paygle\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 C:\Users\bgreen\Source\Paygle\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 C:\Users\bgreen\Source\Paygle\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 C:\Users\bgreen\Source\Paygle\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 C:\Users\bgreen\Source\Paygle\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:809 char:5

  • $domain.CreateInstanceFrom(
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : PathTooLongException

Downgrading to VS 2013 is not an option if your project makes use of C# 6 features either.

@hcavazin

This comment has been minimized.

Show comment
Hide comment
@hcavazin

hcavazin May 5, 2015

Same issue here.
The error occurs if I reference the EntityFramework in more than one project in the same solution.

hcavazin commented May 5, 2015

Same issue here.
The error occurs if I reference the EntityFramework in more than one project in the same solution.

@yishaigalatzer

This comment has been minimized.

Show comment
Hide comment
@yishaigalatzer

yishaigalatzer May 5, 2015

What are the project types you are using? Can someone share a repro project?

yishaigalatzer commented May 5, 2015

What are the project types you are using? Can someone share a repro project?

@hcavazin

This comment has been minimized.

Show comment
Hide comment
@hcavazin

hcavazin May 5, 2015

https://github.com/hcavazin/vs2015err
Very very simple. Just run "Enable-Migrations" to see errors.
I noticed that the error message is not always the same.

hcavazin commented May 5, 2015

https://github.com/hcavazin/vs2015err
Very very simple. Just run "Enable-Migrations" to see errors.
I noticed that the error message is not always the same.

@ryan-codingintrigue

This comment has been minimized.

Show comment
Hide comment
@ryan-codingintrigue

ryan-codingintrigue May 5, 2015

Same issue here when running Add-Migration. Simple class library which was on EF6.1.2, upgraded to 6.1.3 and received lots of these errors.

I upgraded to VS2015 RC from CTP6. Windows 7 Enterprise SP1 (x64) machine.

Should be noted that I tried uninstalling & re-installing EF6.1.3 and I get these errors during the installation process too:

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 X:\MyProjectName\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:809 > char:5

  • $domain.CreateInstanceFrom(
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : PathTooLongException

ryan-codingintrigue commented May 5, 2015

Same issue here when running Add-Migration. Simple class library which was on EF6.1.2, upgraded to 6.1.3 and received lots of these errors.

I upgraded to VS2015 RC from CTP6. Windows 7 Enterprise SP1 (x64) machine.

Should be noted that I tried uninstalling & re-installing EF6.1.3 and I get these errors during the installation process too:

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 X:\MyProjectName\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:809 > char:5

  • $domain.CreateInstanceFrom(
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : PathTooLongException
@ilmax

This comment has been minimized.

Show comment
Hide comment
@ilmax

ilmax May 5, 2015

Contributor

Same issue here

Contributor

ilmax commented May 5, 2015

Same issue here

@divega

This comment has been minimized.

Show comment
Hide comment
@divega

divega May 5, 2015

Member

Thanks everyone. @bricelam and @emgarten investigated and found the root cause. More details in NuGet/Home#528.

Member

divega commented May 5, 2015

Thanks everyone. @bricelam and @emgarten investigated and found the root cause. More details in NuGet/Home#528.

@NooNameR

This comment has been minimized.

Show comment
Hide comment
@NooNameR

NooNameR May 5, 2015

@divega can u make an example how to fix it?

NooNameR commented May 5, 2015

@divega can u make an example how to fix it?

@divega

This comment has been minimized.

Show comment
Hide comment
@divega

divega May 5, 2015

Member

Ultimately the fix will have to go in NuGet bits.

Since the scenario that is broken is when the solution contains multiple projects with references to the same EF package, I suspect if you temporarily unload projects until only one loaded project in the solution references the EF package, that might help as a workaround. I haven't had a chance to verify this myself yet though.

Member

divega commented May 5, 2015

Ultimately the fix will have to go in NuGet bits.

Since the scenario that is broken is when the solution contains multiple projects with references to the same EF package, I suspect if you temporarily unload projects until only one loaded project in the solution references the EF package, that might help as a workaround. I haven't had a chance to verify this myself yet though.

@NooNameR

This comment has been minimized.

Show comment
Hide comment
@NooNameR

NooNameR May 5, 2015

for a now i fixed that error in this way: i go to Manager Nuget, delete from all projects inside my solution EF, and where is a main project with Code First i Install nuget 6.1.3, inside all others i add a Reference: System.Data.Entity, and pick with "quick fix" reference: "EntityFramework", and now all are worked, i can add an migration and all other.

NooNameR commented May 5, 2015

for a now i fixed that error in this way: i go to Manager Nuget, delete from all projects inside my solution EF, and where is a main project with Code First i Install nuget 6.1.3, inside all others i add a Reference: System.Data.Entity, and pick with "quick fix" reference: "EntityFramework", and now all are worked, i can add an migration and all other.

@rgripper

This comment has been minimized.

Show comment
Hide comment
@rgripper

rgripper May 5, 2015

@divega I confirm, unloading other projects using EF makes (at least) migrations commands work again.

rgripper commented May 5, 2015

@divega I confirm, unloading other projects using EF makes (at least) migrations commands work again.

@bricelam

This comment has been minimized.

Show comment
Hide comment
@bricelam

bricelam May 5, 2015

Member

⭐️ Workaround 👇

As a workaround, you can download
this patched version of EntityFramework.psm1, copy it into the packages\EntityFramework.6.1.3\tools directory, restart Visual Studio, and try again.

Member

bricelam commented May 5, 2015

⭐️ Workaround 👇

As a workaround, you can download
this patched version of EntityFramework.psm1, copy it into the packages\EntityFramework.6.1.3\tools directory, restart Visual Studio, and try again.

@hcavazin

This comment has been minimized.

Show comment
Hide comment
@hcavazin

hcavazin May 5, 2015

If comment line <package id =" EntityFramework "version =" 6.1.3 "targetFramework =" net46 "userInstalled =" true "/> in "packages.config" of other projects already solved.

hcavazin commented May 5, 2015

If comment line <package id =" EntityFramework "version =" 6.1.3 "targetFramework =" net46 "userInstalled =" true "/> in "packages.config" of other projects already solved.

@imarrero

This comment has been minimized.

Show comment
Hide comment
@imarrero

imarrero May 5, 2015

You ALL are TERRIFIC!! - Thank you very much for your effort
Yes @bricelam 's workaround works like a charm.

Happy on my first day with VS 2015 Community Edition

Thanks.

imarrero commented May 5, 2015

You ALL are TERRIFIC!! - Thank you very much for your effort
Yes @bricelam 's workaround works like a charm.

Happy on my first day with VS 2015 Community Edition

Thanks.

@yishaigalatzer

This comment has been minimized.

Show comment
Hide comment
@yishaigalatzer

yishaigalatzer commented May 5, 2015

@bricelam ❤️

@brendangreen

This comment has been minimized.

Show comment
Hide comment
@brendangreen

brendangreen May 5, 2015

@bricelam worked a treat. Really appreciate it!

brendangreen commented May 5, 2015

@bricelam worked a treat. Really appreciate it!

@rgripper

This comment has been minimized.

Show comment
Hide comment
@rgripper

rgripper May 6, 2015

@bricelam's script is not signed, don't forget to unblock it and probably even do
(admin cmd)> powershell Set-ExecutionPolicy Unrestricted
while its not completely fixed, to allow execution in Package manager console

rgripper commented May 6, 2015

@bricelam's script is not signed, don't forget to unblock it and probably even do
(admin cmd)> powershell Set-ExecutionPolicy Unrestricted
while its not completely fixed, to allow execution in Package manager console

@ilmax

This comment has been minimized.

Show comment
Hide comment
@ilmax

ilmax May 6, 2015

Contributor

👍 for @bricelam, your workaround works like a charm, thank you!

Contributor

ilmax commented May 6, 2015

👍 for @bricelam, your workaround works like a charm, thank you!

@divega

This comment has been minimized.

Show comment
Hide comment
@divega

divega May 14, 2015

Member

NuGet/Home#528 has been fixed (thanks @yishaigalatzer and @AndriySvyryd) so the workaround should become unnecessary the next time NuGet clients is refreshed.

Member

divega commented May 14, 2015

NuGet/Home#528 has been fixed (thanks @yishaigalatzer and @AndriySvyryd) so the workaround should become unnecessary the next time NuGet clients is refreshed.

@divega divega closed this May 14, 2015

@mrchief

This comment has been minimized.

Show comment
Hide comment
@mrchief

mrchief May 15, 2015

👍 For such quick turnaround!

mrchief commented May 15, 2015

👍 For such quick turnaround!

@sebrojas14

This comment has been minimized.

Show comment
Hide comment
@sebrojas14

sebrojas14 Jun 4, 2015

When is gonna be refreshed the NuGet client? I have this problme today

sebrojas14 commented Jun 4, 2015

When is gonna be refreshed the NuGet client? I have this problme today

@sebrojas14

This comment has been minimized.

Show comment
Hide comment
@sebrojas14

sebrojas14 Jun 4, 2015

Going back to Visual Studio Community 2013...

sebrojas14 commented Jun 4, 2015

Going back to Visual Studio Community 2013...

@brendangreen

This comment has been minimized.

Show comment
Hide comment
@brendangreen

brendangreen Jun 4, 2015

@sebrojas14 or....you could use the workaround that was posted by @bricelam.

brendangreen commented Jun 4, 2015

@sebrojas14 or....you could use the workaround that was posted by @bricelam.

@yishaigalatzer

This comment has been minimized.

Show comment
Hide comment
@yishaigalatzer

yishaigalatzer Jun 4, 2015

We just dropped a new nuget client on codeplex https://nuget.codeplex.com/releases/view/615507 give it at try

yishaigalatzer commented Jun 4, 2015

We just dropped a new nuget client on codeplex https://nuget.codeplex.com/releases/view/615507 give it at try

@Casimodo72

This comment has been minimized.

Show comment
Hide comment
@Casimodo72

Casimodo72 Jun 4, 2015

@yishaigalatzer, great! Using NuGet 3.0 RC2 heals the issue. Actually this problem held me away from moving from VS 2013 to VS 2015 RC.

Casimodo72 commented Jun 4, 2015

@yishaigalatzer, great! Using NuGet 3.0 RC2 heals the issue. Actually this problem held me away from moving from VS 2013 to VS 2015 RC.

@rowanmiller

This comment has been minimized.

Show comment
Hide comment
@rowanmiller

rowanmiller Jun 4, 2015

Member

@Casimodo72 thanks for confirming!

I've added the updated client to the list of workarounds

Member

rowanmiller commented Jun 4, 2015

@Casimodo72 thanks for confirming!

I've added the updated client to the list of workarounds

@sebrojas14

This comment has been minimized.

Show comment
Hide comment
@sebrojas14

sebrojas14 Jun 5, 2015

Nice to know, but I already dongrade my company PCs to VS 2013. Maybe I will wait until stable release came, vecause uninstall, download and install its a long process

sebrojas14 commented Jun 5, 2015

Nice to know, but I already dongrade my company PCs to VS 2013. Maybe I will wait until stable release came, vecause uninstall, download and install its a long process

@divega

This comment has been minimized.

Show comment
Hide comment
@divega

divega Jun 5, 2015

Member

@sebrojas14 for sure waiting for the stable release of VS 2015 is reasonable, but if you want to continue trying the pre-release version, it should actually work side-by-side with VS 2013 on the same PC.

Member

divega commented Jun 5, 2015

@sebrojas14 for sure waiting for the stable release of VS 2015 is reasonable, but if you want to continue trying the pre-release version, it should actually work side-by-side with VS 2013 on the same PC.

@yishaigalatzer

This comment has been minimized.

Show comment
Hide comment
@yishaigalatzer

yishaigalatzer Jun 5, 2015

And of course if you find more bugs there is still some time to fix them

yishaigalatzer commented Jun 5, 2015

And of course if you find more bugs there is still some time to fix them

@mafshin

This comment has been minimized.

Show comment
Hide comment
@mafshin

mafshin Jun 22, 2015

@bricelam solution worked in VS 2015 RC - Need to Unblock the file if it's replaced.

mafshin commented Jun 22, 2015

@bricelam solution worked in VS 2015 RC - Need to Unblock the file if it's replaced.

@jkmuka

This comment has been minimized.

Show comment
Hide comment
@jkmuka

jkmuka Jul 17, 2015

I am getting this error on VS2015 RC and the workarounds have not worked. I have found that the error occurs when you have multiple projects referencing EF. So I have a DataContext project with EF 6.1.3, then I have a client project(console, unit test, web, etc.) that references the DataContext project and EF 6.1.3. If I remove the client project from the solution the error goes away. Someone correct me if I am wrong, but I don't think this is a viable workaround. When you have a project that references your DataContext project it also needs the EF reference. Also when I try the workaround to use the patched psm file I get this "Import-Module : File ..\EntityFramework.6.1.3\tools\EntityFramework.psm1 cannot be loaded. The file
...\EntityFramework.6.1.3\tools\EntityFramework.psm1 is not digitally signed. You cannot run this script on the current system. For
more information about running scripts and setting execution policy, see about_Execution_Policies "

Update: work around does work I just needed to Set-ExecutionPolicy Unrestricted for the patched psm1 to work.

jkmuka commented Jul 17, 2015

I am getting this error on VS2015 RC and the workarounds have not worked. I have found that the error occurs when you have multiple projects referencing EF. So I have a DataContext project with EF 6.1.3, then I have a client project(console, unit test, web, etc.) that references the DataContext project and EF 6.1.3. If I remove the client project from the solution the error goes away. Someone correct me if I am wrong, but I don't think this is a viable workaround. When you have a project that references your DataContext project it also needs the EF reference. Also when I try the workaround to use the patched psm file I get this "Import-Module : File ..\EntityFramework.6.1.3\tools\EntityFramework.psm1 cannot be loaded. The file
...\EntityFramework.6.1.3\tools\EntityFramework.psm1 is not digitally signed. You cannot run this script on the current system. For
more information about running scripts and setting execution policy, see about_Execution_Policies "

Update: work around does work I just needed to Set-ExecutionPolicy Unrestricted for the patched psm1 to work.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 28, 2015

Having the same issue with Visual Studio 2013 Update 5. Any fix avl. for that?
Ok, this looks like this is another issue.
When I install Visual Studio 2015 Update 5, then "Entity Framework 5.dll" can't be found by Add-Migration and Update-Database command.

PM> Add-Migration test
Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its 
dependencies. Das System kann die angegebene Datei nicht finden."
At C:\Source\pegasus7\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:431 char:5
+     $domain.CreateInstanceFrom(
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FileNotFoundException

Wokraround: add Entity Framework 5.dll" to GAC

ghost commented Jul 28, 2015

Having the same issue with Visual Studio 2013 Update 5. Any fix avl. for that?
Ok, this looks like this is another issue.
When I install Visual Studio 2015 Update 5, then "Entity Framework 5.dll" can't be found by Add-Migration and Update-Database command.

PM> Add-Migration test
Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its 
dependencies. Das System kann die angegebene Datei nicht finden."
At C:\Source\pegasus7\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:431 char:5
+     $domain.CreateInstanceFrom(
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FileNotFoundException

Wokraround: add Entity Framework 5.dll" to GAC

@maartenba

This comment has been minimized.

Show comment
Hide comment
@maartenba

maartenba commented Aug 3, 2015

Similar issue: NuGet/NuGetGallery#2592

@weitzhandler

This comment has been minimized.

Show comment
Hide comment
@weitzhandler

weitzhandler Sep 25, 2015

Contributor

Still having the same issue. VS2015 on a new project of ASP.NET 4 MVC 5.2, trying to call Enable-Migrations. This is unbelievable. It's like the ASP.NET dropped the support for the released version focusing on the unreleased beta.
I tried the workaround of the first post - none worked. I have a solution that contains a single project.

Contributor

weitzhandler commented Sep 25, 2015

Still having the same issue. VS2015 on a new project of ASP.NET 4 MVC 5.2, trying to call Enable-Migrations. This is unbelievable. It's like the ASP.NET dropped the support for the released version focusing on the unreleased beta.
I tried the workaround of the first post - none worked. I have a solution that contains a single project.

@brendangreen

This comment has been minimized.

Show comment
Hide comment
@brendangreen

brendangreen Sep 25, 2015

@weitzhandler - which workaround? The new nuget, or the patches psm1?

brendangreen commented Sep 25, 2015

@weitzhandler - which workaround? The new nuget, or the patches psm1?

@weitzhandler

This comment has been minimized.

Show comment
Hide comment
@weitzhandler

weitzhandler Sep 25, 2015

Contributor

@brendangreen Both. I have the latest NuGet (3.2), and tried replacing the psm1 file. Neither worked.

Contributor

weitzhandler commented Sep 25, 2015

@brendangreen Both. I have the latest NuGet (3.2), and tried replacing the psm1 file. Neither worked.

@brendangreen

This comment has been minimized.

Show comment
Hide comment
@brendangreen

brendangreen Sep 25, 2015

Post your error message.  It's possible that there may be a different issue?
On 25/09/2015 11:17:53 AM, Shimmy notifications@github.com wrote:
Still having the same issue. VS2015 on a new project of ASP.NET 4 MVC 5.2, trying to call Enable-Migrations. This is unbelievable. It's like the ASP.NET dropped the support for the released version focusing on the unreleased beta.
I tried the workaround of the first post [https://github.com/aspnet/EntityFrameworkCore/issues/1950#issue-65169768] - none worked. I have a solution that contains a single project.

Reply to this email directly or view it on GitHub [https://github.com/aspnet/EntityFrameworkCore/issues/1950#issuecomment-143096434].

brendangreen commented Sep 25, 2015

Post your error message.  It's possible that there may be a different issue?
On 25/09/2015 11:17:53 AM, Shimmy notifications@github.com wrote:
Still having the same issue. VS2015 on a new project of ASP.NET 4 MVC 5.2, trying to call Enable-Migrations. This is unbelievable. It's like the ASP.NET dropped the support for the released version focusing on the unreleased beta.
I tried the workaround of the first post [https://github.com/aspnet/EntityFrameworkCore/issues/1950#issue-65169768] - none worked. I have a solution that contains a single project.

Reply to this email directly or view it on GitHub [https://github.com/aspnet/EntityFrameworkCore/issues/1950#issuecomment-143096434].

@weitzhandler

This comment has been minimized.

Show comment
Hide comment
@weitzhandler

weitzhandler Sep 25, 2015

Contributor

@brendangreen
This was all brought above but to make you happy here you go:

enable-migration : The term 'enable-migration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1
+ enable-migration
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (enable-migration:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

BTW, all the related EF commands (i.e. get-help entityframework) don't work either.

Contributor

weitzhandler commented Sep 25, 2015

@brendangreen
This was all brought above but to make you happy here you go:

enable-migration : The term 'enable-migration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1
+ enable-migration
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (enable-migration:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

BTW, all the related EF commands (i.e. get-help entityframework) don't work either.

@brendangreen

This comment has been minimized.

Show comment
Hide comment
@brendangreen

brendangreen Sep 25, 2015

When I was using the work around, I had to Import-Module the psm1 file. You did that?

brendangreen commented Sep 25, 2015

When I was using the work around, I had to Import-Module the psm1 file. You did that?

@weitzhandler

This comment has been minimized.

Show comment
Hide comment
@weitzhandler

weitzhandler Sep 25, 2015

Contributor

@brendangreen
Well after explicitly uninstalled EntityFramework (Uninstall-Package EntityFramework) and reinstalled it it works now.

Contributor

weitzhandler commented Sep 25, 2015

@brendangreen
Well after explicitly uninstalled EntityFramework (Uninstall-Package EntityFramework) and reinstalled it it works now.

@Gillardo

This comment has been minimized.

Show comment
Hide comment
@Gillardo

Gillardo Oct 16, 2015

Anyone else still getting this problem? I have created a new ASP.NET 5 solution with 5 different projects, one is using EntityFramework 6.1.3 and is being referenced by the other projects. If i try to do enable-migrations i just get this error

enable-migrations : The term 'enable-migrations' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ enable-migrations
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (enable-migrations:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I have tried uninstalling and reinstalling EntityFramework, but still doesnt work?

Worth mentioning that these are all .xproj types, not csproj

Gillardo commented Oct 16, 2015

Anyone else still getting this problem? I have created a new ASP.NET 5 solution with 5 different projects, one is using EntityFramework 6.1.3 and is being referenced by the other projects. If i try to do enable-migrations i just get this error

enable-migrations : The term 'enable-migrations' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ enable-migrations
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (enable-migrations:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I have tried uninstalling and reinstalling EntityFramework, but still doesnt work?

Worth mentioning that these are all .xproj types, not csproj

@rowanmiller

This comment has been minimized.

Show comment
Hide comment
@rowanmiller

rowanmiller Oct 16, 2015

Member

@Gillardo If you are using ASP.NET 5 then the PowerShell commands do not work (due to limitation in the ASP.NET 5 project system). You need to drop out to the command line, see here for more details http://ef.readthedocs.org/en/latest/getting-started/aspnet5.html#create-your-database.

Member

rowanmiller commented Oct 16, 2015

@Gillardo If you are using ASP.NET 5 then the PowerShell commands do not work (due to limitation in the ASP.NET 5 project system). You need to drop out to the command line, see here for more details http://ef.readthedocs.org/en/latest/getting-started/aspnet5.html#create-your-database.

@Gillardo

This comment has been minimized.

Show comment
Hide comment
@Gillardo

Gillardo Oct 16, 2015

This is referencing EF7, not EF6. I managed to get round this, by creating a .csproj for my EF6 project, and then added all the files from my .xproj, by using the "Add By Link" option. This way i havent got 2 copies of the files. Now using my .csproj i can run all my commands for EF6, and when i build my .xproj i have the latest versions etc.

But support for EF6 natively in .xproj would be great

Gillardo commented Oct 16, 2015

This is referencing EF7, not EF6. I managed to get round this, by creating a .csproj for my EF6 project, and then added all the files from my .xproj, by using the "Add By Link" option. This way i havent got 2 copies of the files. Now using my .csproj i can run all my commands for EF6, and when i build my .xproj i have the latest versions etc.

But support for EF6 natively in .xproj would be great

@rowanmiller

This comment has been minimized.

Show comment
Hide comment
@rowanmiller

rowanmiller Oct 16, 2015

Member

Ah, sorry I missed that. The same limitation holds true (as you discovered). Sounds like you have the right work around for the moment.

Member

rowanmiller commented Oct 16, 2015

Ah, sorry I missed that. The same limitation holds true (as you discovered). Sounds like you have the right work around for the moment.

@amirhaghajani

This comment has been minimized.

Show comment
Hide comment
@amirhaghajani

amirhaghajani Sep 30, 2017

in package manager console
Import-Module (your project path)\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1

amirhaghajani commented Sep 30, 2017

in package manager console
Import-Module (your project path)\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment