development

'Update-Database'라는 용어는 cmdlet의 이름으로 인식되지 않습니다.

big-blog 2020. 8. 18. 08:11
반응형

'Update-Database'라는 용어는 cmdlet의 이름으로 인식되지 않습니다.


EF5 beta1을 사용하고 있으며 이전에 "Update-Database"를 실행할 수있었습니다. 이제 Visual Studio를 종료 했으므로 실행할 수 없습니다. 다음과 같은 오류가 발생합니다.

'Update-Database'라는 용어는 cmdlet, 함수, 스크립트 파일 또는 작동 가능한 프로그램의 이름으로 인식되지 않습니다. 이름의 철자를 확인하거나 경로가 포함 된 경우 경로가 올바른지 확인하고 다시 시도하십시오. 줄 : 1 char : 16 + Update-Database <<<< -verbose + CategoryInfo : ObjectNotFound : (Update-Database : String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

EF5b1을 다시 설치하려고 시도했지만 성공적으로 (이미 설치됨) 'Update-Database'가 여전히 작동하지 않습니다.

누구든지 도울 수 있습니까 ???


나는 최근 에이 문제를 여러 번 겪었습니다. 효과가있는 해결책은 패키지 관리자 콘솔을 닫고 Visual Studio를 닫은 다음 다시 여는 것입니다. 재부팅도 대부분의 경우 작동했지만 항상 그런 것은 아닙니다.


Entity Framework를 사용하는 경우 :

오류 메시지 : "오류 메시지 (PMC의 Update-Database 명령에서) : 'Update-Database'라는 용어는 cmdlet, 함수, 스크립트 파일 또는 작동 가능한 프로그램의 이름으로 인식되지 않습니다. 이름의 철자를 확인하십시오. 또는 경로가 포함 된 경우 경로가 올바른지 확인하고 다시 시도하십시오. "

해결 방법 : "Visual Studio를 종료합니다. 프로젝트를 다시 열고 다시 시도하십시오."

자세한 내용 은 MVC 5 웹 응용 프로그램을위한 고급 Entity Framework 6 시나리오 (12/12) 를 참조하십시오.

도움이 되었기를 바랍니다...


때때로 VS를로드 할 때 패키지 관리자 콘솔에 다음이 표시됩니다.

값은 null 일 수 없습니다.

매개 변수 이름 : path1

그 원인은 아직 모르겠지만 EF powershell 확장과 같은 특정 모듈의 등록을 중단하는 Powershell 콘솔을 시작하는 동안 문제가 발생한 것 같습니다. 그러나 수동으로로드 할 수 있습니다.

Import-Module .\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1

6.1.1을 현재 버전의 Entity Framework로 바꾸십시오.


Nuget 패키지를 다시 설치하면이 문제가 해결되었습니다.

즉, 실행

Install-Package EntityFramework -Version 5.0.0

패키지 관리자에서


Visual Studio를 다시 시작하면 문제가 해결됩니다. 나를 위해 작동합니다.


EF 도구가 제대로 설치되지 않은 경우이 오류가 발생합니다.

Nuget 패키지 관리자에서 아래 명령을 시도하십시오. // 동일한 버전의 EF를 제거하고 설치합니다.

Update-Package "EntityFramework" -reinstall

여전히 같은 문제에 직면한다면. 새 웹 프로젝트를 만들고 nuget에서 아래 명령을 실행하십시오.

(참고 : 동일한 솔루션 또는 동일한 위치에 새 프로젝트를 만들 필요가 없습니다.)

// 이렇게하면 EF가 최신 버전 (도구 포함)으로 업데이트됩니다. // 특정 버전을 사용하려면 -version플래그를 사용합니다 .

Update-Package "EntityFramework"

이 작업이 완료되면 원래 프로젝트를 chcek하고 새로 생성 된 프로젝트를 삭제할 수 있습니다.


나는 똑같은 문제가 있었고 그 원인은 내 경로 이름에 있었고 내 경로에는 다음과 같이 곧은 대괄호가있는 디렉토리 이름이 C:\[PROJ]\TestApp있었습니다.

괄호를 제거하면 ~까지 C:\PROJ\TestApp잘 작동하기 시작했습니다.


그냥 ReOpen Visual Studio가 저에게 적합합니다.


나에게 문제는 Nuget 버전 이었습니다.

  1. Nuget Package Manager를 제거하십시오.
  2. Visual Studio를 다시 시작하십시오.
  3. Nuget Package Manager의 새 버전을 설치했습니다.
  4. 그런 다음 Visual Studio를 다시 시작하십시오.

이 문제는 파일 탐색기에서 직접 프로젝트를 열 때 발생하는 것 같습니다. 먼저 VS를 시작한 다음 프로젝트를 열어보십시오. 나는 이것이 경로에 대한 액세스에 관한 것이라고 생각합니다.


"Microsoft.EntityFrameworkCore"및 "Microsoft.EntityFrameworkCore.Tools"를 제거하고 다시 설치하여 해결했습니다.


.Net Core 및 EntityFrameworkCore를 사용하는 모든 사용자 :

Microsoft.EntityFrameworkCore.Tools이 문제를 해결 하려면 패키지 를 설치해야합니다 .

자세한 내용은 https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell에서 확인하세요.


제 경우에는 다음을 수행했습니다.-패키지 관리자 콘솔 상단의 "복원"버튼을 클릭하여 누락 된 NuGet 패키지 복원-Visual Studio 다시 시작- "update-databse"실행


Restoring NuGet package didn'y help me. So I had to reinstall package manager - https://visualstudiogallery.msdn.microsoft.com/4ec1526c-4a8c-4a84-b702-b21a8f5293ca May be it helps someone


If the other answers don't work (VS 2017): clear the NuGet cache, restart VS, then restore the packages.


I found that it was due to a corrupt package. I had installed Automapper when it was already installed. It was only clear that this package was corrupt when I tried to install another package.

Removing the corrupt package solved this issue for me.

You can then reinstall automapper. The issue was with version 5.4, I am now happily on 6.0.


For me it turns out EntityFramework core was not installed on my project (because i started with blank project). So installing EntityFramework package resolved the problem. Sometimes if EntityFramework installation failed then try to install individual packages one by one

E.g.

Microsoft.EntityFrameworkCore.Design
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.SqlServer.Design
Microsoft.EntityFrameworkCore.Tools

I solved by updateing Package Manager Console.

I was not getting Update-Database in Package Manager Console. Then i restart several time. Also restart Windows.

Then I download new one from nuget and then it was solved.


I had this problem in Visual Studio 2015 and resolved it by updating the version of Nuget.

Tools -> Extensions and Updates -> Updates -> Visual Studio Gallery


Simple fix for me was to make sure there was a dash between update and database, like this: update-database and use lowercase. It may be coincidental, but when I did this in Packet Manager Console, the database actually updated and I got the done message rather than the not recognized as the name of a cmdlet, function, script file error.


I started having the same issue after I accidentally opened a Visual Studio solution with Visual Studio 2015 instead of 2017. The project worked just fine before that mishap. It was an older project with EF 5.0 and not EF Core.

I tried everything suggested - restarted Visual Studio countless times, cleaned up NuGet cache, deleted everything in packages folder, reinstalled EF 5 for the project - no good, add-migration was not recognized. If I upgraded EF to 6, it started to recognize the commands, but I did not want to upgrade yet. So, as soon as I reverted back to EF 5, the problem returned.

The only thing that finally saved me was to do the following:

  • close Visual Studio
  • delete everything from packages folder
  • delete .vs folder in the root of your solution. This folder is usually hidden, you have to turn on Show hidden files and folders setting or check Hidden items in folder View tab
  • start Visual Studio and open your solution. It will ask to restore NuGet packages, agree to it.

Now EF commands finally started working again.


In my case:

  • Reload project did not help
  • Restart VS did not help
  • Restart computer did not help
  • Reinstal EF did not help

But I found an article where suggestion was to manualy import missing EF package, using PM Conole:

Import-Module .\packages\EntityFramework.X.X.X\tools\EntityFramework.psm1

And this solution solved my problem.


In my case restarting Visual Studio (many, many times) did not work, then as I was looking elsewhere I found a message on the output terminal:

The current .NET SDK does not support targeting .NET Core 2.2. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2.

So I installed the required version of .NET Core and the command ran successfully.


For me the problem was the Nuget version.

I removed and re-installed Nuget then re-started Visual Studio and then all started working.

참고 URL : https://stackoverflow.com/questions/9674983/the-term-update-database-is-not-recognized-as-the-name-of-a-cmdlet

반응형