NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

Error occurred while restoring NuGet packages: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) #6841

Open abpiskunov opened 6 years ago

abpiskunov commented 6 years ago

Details about Problem

Opening my repro solution with 5 projects (1 classic and 4 core projects targeting netcoreapp2.0) ends up in failed restore with the error in the title.

NuGet version (x.x.x.xxx):

dotnet.exe --version (if appropriate): 2.1.200-preview-007570

VS version (if appropriate): d15.7 27613.0

OS version (i.e. win10 v1607 (14393.321)): Win10

Worked before? If so, with which NuGet version:

Detailed repro steps so we can see the same problem

  1. Open \vwdbuild01\Temp\antonpis\repro\NestingTestSolution.zip solution on the build i specified or newer.

  2. See error after restore: Error occurred while restoring NuGet packages: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))

Verbose Logs

Please include verbose logs (NuGet.exe -verbosity detailed | dotnet.exe --verbosity diag | etc...)

Sample Project

Very helpful if you can zip a project and paste into this issue!

Error occurred while restoring NuGet packages: System.Runtime.InteropServices.COMException (0x8002801D): Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at System.Runtime.InteropServices.CustomMarshalers.EnumerableViewOfDispatch.GetEnumerator() at System.Collections.IEnumerable.GetEnumerator() at System.Linq.Enumerable.d95`1.MoveNext() at NuGet.PackageManagement.VisualStudio.VsCoreProjectSystemReferenceReader.d3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.ProjectManagement.MSBuildNuGetProject.d40.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.PackageManagement.DependencyGraphRestoreUtility.d7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.SolutionRestoreManager.SolutionRestoreJob.d18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at NuGet.SolutionRestoreManager.SolutionRestoreJob.d16.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at NuGet.SolutionRestoreManager.SolutionRestoreJob.d16.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.SolutionRestoreManager.SolutionRestoreJob.d15.MoveNext()

nkolev92 commented 6 years ago

@abpiskunov

Is this consistently reproducible? Can you repro it on any other machines?

I'd imagine repairing your VS installation should fix it, but ideally before doing that, it'd be great if you filled an issue through the VS Feedback mechanism as it's easier to analyze issues like this there.

abpiskunov commented 6 years ago

i could give you access to the machine if you want to.

nkolev92 commented 6 years ago

@abpiskunov Sure that'd be great.

sagoo33 commented 6 years ago

I have just updated to vs2017 15.7 and installed nodejs & angular cli, after that no solutions are able to restore nuget packages with error above.

Also in the package manager console receiving "Unable to find fallback package folder 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackagesFallback\'."

I went and created an empty folder "C:\Program Files (x86)\Microsoft SDKs\NuGetPackagesFallback" and now the packages are able to be restored again.

However, trying to add or update packages still fails with: CACHE https://api.nuget.org/v3/registration3-gz-semver2/htmlagilitypack/index.json GET https://motorcentral.pkgs.visualstudio.com/_packaging/aa44b555-945f-4888-8227-d8de1a13cd21/nuget/v3/registrations2/htmlagilitypack/index.json System.Runtime.InteropServices.COMException (0x8002801D): Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at System.Runtime.InteropServices.CustomMarshalers.EnumerableViewOfDispatch.GetEnumerator() at System.Collections.IEnumerable.GetEnumerator() at System.Linq.Enumerable.<CastIterator>d__971.MoveNext() at NuGet.PackageManagement.VisualStudio.VsCoreProjectSystemReferenceReader.d3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.ProjectManagement.MSBuildNuGetProject.d41.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.PackageManagement.DependencyGraphRestoreUtility.d7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.PackageManagement.DependencyGraphRestoreUtility.d3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at NuGet.PackageManagement.NuGetPackageManager.d77.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at NuGet.PackageManagement.NuGetPackageManager.d68.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.PackageManagement.UI.UIActionEngine.d18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at NuGet.PackageManagement.UI.UIActionEngine.<>cDisplayClass12_0.<b__0>d.MoveNext()`

bcubedb3 commented 6 years ago

same problem for me ... i already had this package installed for other projects in this solution. adding a new project to the solution got this error. i also upgraded to vs2017 15.7 yesterday.

nkolev92 commented 6 years ago

This seems like a dup to https://developercommunity.visualstudio.com/content/problem/231598/nuget-type-e-libnotregistered.html.

//cc @tmeschter Can you please confirm?

Should this be moved to project-system side according to your comment on the following

luizluan commented 6 years ago

Same problem here, Visual Studio 15.7

I fixed

If you have Office Uninstall Office and install again. Or do the following if you use outlook remove the default settings (control panel / mail), modify office by removing outlook and add the outlook again then open it.

Repair Visual Studio or modify to use Microsoft Visual Studio Office Tools

Nuget Package works

tmeschter commented 6 years ago

@nkolev92 @abpiskunov @sagoo33 I'm only aware of this error occurring on systems where certain builds of 15.8 Preview were installed side-by-side with 15.7 (or Preview builds of 15.7 installed SxS with 15.6, etc.).

Most VS components are local to the installation directory, allowing you to have different builds of VS in different directories without any conflicts. However, there are still a few shared components, some of which register COM types. The latest version of these will always "win". So if you install a 15.7 build and a 15.8 build, 15.7 will use the 15.8 version of the shared component. Normally this is fine as the 15.8 version contains everything that was in the 15.7 version (plus new stuff, of course). However, it is possible that something is added to the 15.7 version of the shared component late in the development cycle and hasn't had a chance to propagate to the 15.8 builds by the time you install one of the previews. In this case the 15.8 version of the shared component will be missing an item, like a COM type library, that 15.7 expects to find.

This is an inherent danger of installing Preview builds; there isn't really anything to "fix" here.

Now if you're running into this error and you've never installed a Preview build on this system then that's a different issue, and not one I'm familiar with. In that case I suggest trying to figure out the identity of the missing type library.

nkolev92 commented 6 years ago

Thanks for the explanation @tmeschter

Has anyone hit this issue without a side-by-side installation of Visual Studio?

abpiskunov commented 6 years ago

I did not see this in other version of VS. I had 15.8, 15.9 and 16 on different machines side by side. Was it only for 15.7 and 15.8? Is shared component removed now? I had an impression that with willow priority is very high to get all VS instances to be independent.