programing

패키지를 설치하는 동안 NuGet 추가 참조 오류

goodcopy 2021. 1. 18. 22:04
반응형

패키지를 설치하는 동안 NuGet 추가 참조 오류


Nuget으로 패키지를 설치할 수 없습니다. 예를 들어 엔터티 프레임 워크를 설치하려면 다음 오류가 발생합니다.

install-package EntityFramework
Successfully installed 'EntityFramework 4.2.0.0'.
Successfully uninstalled 'EntityFramework 4.2.0.0'.
Install failed. Rolling back...
Install-Package : Failed to add reference to 'EntityFramework'.
At line:1 char:16
+ install-package <<<<  EntityFramework
   + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
   +FullyQualifiedErrorId:NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

콘솔 또는 GUI에서 모든 패키지를 설치하는 동안 동일한 오류가 발생합니다. Nuget을 다시 설치하고 다른 확장 기능을 비활성화하고 VS를 관리자로 실행해도 도움이되지 않았습니다.

문안 인사


나도이 문제가 있었고 나를 위해 일한 수정 사항은 다음과 같습니다.

  1. 패키지 폴더 내의 모든 폴더를 삭제하십시오.
  2. Nuget 패키지 관리자에서 모든 패키지를 업데이트합니다.

다음은 나를 위해 해결 된 것입니다 : VS2012 with EF6

여기에서 내 대답을 찾았습니다. http://richardschneider.net/blog/wordpress/?p=21

VS 명령 프롬프트에서 다음 명령을 실행합니다.

regsvr32 "C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VsLangproj.olb"

그런 다음 패키지 관리자 콘솔로 이동하여 다음을 실행하십시오.

Install-Package EntityFramework -Version 6.1.3

같은 고통을 겪습니다. 결국 그것은 발생합니다

Tools -> Options -> Nuget Package Manager -> Package Sources 

nuget.org가 선택 취소되었습니다. 확인하면 문제가 해결됩니다.


이 문제도 만났습니다. 불행히도 저에게 효과가 있었던 유일한 해결책은 Visual Studio를 완전히 제거하고 제거 후 남은 폴더를 삭제하고 컴퓨터를 재부팅 한 다음 Visual Studio를 다시 설치하는 것입니다.

Visual Studio '복구'가 작동하지 않았습니다. 완전히 재설치하십시오.


이 문제도 패키지 관리자 콘솔 Uninstall-Package EntityFramework -force에 입력 한 다음 패키지 폴더에서 EntityFramework 폴더를 삭제 한 다음 다시 설치하는 것입니다.Install-Package EntityFramework


패키지 캐시를 지워 문제가 해결되었습니다.

Tools->package Manager->Package Manager Settings-> Clear Package Cache

내 Visual Studio 2015 nuget을 업데이트 한 후 작동이 중지되었습니다.

게시 된 솔루션을 읽은 후 알려진 버그라는 것을 발견했습니다. http://blog.nuget.org/20150226/nuget-3.0-beta2.html을 참조하십시오.

Visual Studio에서 나는 unistalled nuget 확장, closed visual studio, https://dist.nuget.org/index.html 에서 최신 nuget 버전을 다운로드하여 설치했습니다.

효과가 있었다


나는 같은 문제에 부딪쳤다. 다음을 수행했습니다.

update-package jQuery.

Install-Package Twitter.Bootstrap -Version 3.0.0

아마도 Bootstrap 버전 3.0.0JQuery 최신 버전 에서 작동 하기 때문에 작동했습니다 .


나를 위해 문제는 git clean -dfx.


관리자 권한 프롬프트에서이 명령을 실행하면 내 문제가 해결되었습니다.

regsvr32 "C : \ Program Files (x86) \ Common Files \ microsoft shared \ MSEnv \ VsLangproj.olb"

출처 : https://docs.nuget.org/Release-Notes/Known-Issues


Windows 10 컴퓨터에서 거의 동일한 문제가 발생했으며 TFS에서 "최신 버전 가져 오기"를 실행 한 후 Visual Studio 2015에서 참조가 작동하지 않는 이유와 NuGet 패키지를 복원 할 수없는 이유를 파악할 수 없었습니다. 어떤 이유로 NuGet은 컴퓨터에 두 개의 패키지 폴더를 추가했고 프로젝트에서 패키지 폴더 만 삭제했습니다.

위치 :

C : \ Users \ YourUser \ Documents \ Visual Studio 2015 \ Projects \ YourProject \ packages C : \ Users \ YourUser.nuget \ packages

두 패키지 폴더가 모두 제거되면 NuGet 패키지를 복원 할 수 있었고 모든 것이 다시 작동했습니다.


Visual Studio 2015 업데이트 3에 갔을 때 실패했습니다. 패키지 폴더 / 캐시 등을 지우는 다른 답변에서 많은 단계를 시도했습니다.

결국 나는 그것을 통해 작동했습니다.

  • 전체 제거.
  • Visual Studio의 모든 파일 / 위치 (AppData / Documents / etc)를 찾았습니다.
  • New re-install, it still didn't work (I had missed files in other locations).
  • Ran devenv commands : like /resetuserdata and /resetsettings
  • Ran a repair action.

So just note doing a full uninstall won't clear out all your settings/cache data.


The problem occurred in my entity framework version. I was using an older version of entity framework, After deleting older version of EF and re installing it with the latest version available helped me solving this issue.


I deleted the project, created fresh one, first added entity framework reference. it worked.. moved necessary code back into the project


In my case, deleting all occurrences of 'EntityFramework...' files in the Bin folder (open the folder in Windows Explorer) worked form me. I didn't have the packages folder in my project. The 'EntityFramework...' files were added by different action.

NOTE: You may need to rebuild project to remove error(s).


I also ran into this case when installing the AttributeRouting package. After googling a while, i tried the following steps and it works for me:

  1. Tools > Extensions and Updates: uninstall NuGet Package Manager and reinstall it. Restart the Visual Studio.

  2. Tools > Options > Package Manager > Package Sources: make sure to check for the nuget.org source.

Hope this help.


In my case, specifying the desidered version has solved the problem. That's probably because different projects in the same solution reference different version of the same Package. In that case, Nuget doesn't know the desidered version, hence the exception.

Just use this syntax:

Install-Package XXXX -Version A.B.C.D

I had this problem in Visual Studio 2017 in Windows 10.

I had an existing project, and I updated the .Net Framework from 4.6.2 to 4.7.2, and the Entity Framework from 6.1.3 to 6.2.0. I rebuilt and deployed the application, but it failed to connect to my database because the reference to EntityFramework.SqlServer was broken.

I used the Package Manager UI to remove the Entity Framework from both projects in my solution. I attempted to re-add the Entity Framework, but it failed every time. I had to remove the Entity Framework from both projects and save the solution to source control (TFS), and then add the Entity Framework back in.

This successfully added the Entity Framework and the EntityFramework.SqlServer reference.

ReferenceURL : https://stackoverflow.com/questions/8314400/nuget-add-reference-error-while-installing-packages

반응형