Cannot add any NuGet package to project
Just created a new c++ console project. When trying to add ANY nugget package (sdl2 in this example) I receive following error:
@ Installing sdl2.nuget in TestProject started
Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at NuGet.PackageManagement.NuGetPackageManager.PreviewBuildIntegratedProjectsActionsAsync(IReadOnlyCollection`1 buildIntegratedProjects, Dictionary`2 nugetProjectActionsLookup, PackageIdentity packageIdentity, IReadOnlyCollection`1 primarySources, INuGetProjectContext nuGetProjectContext, VersionRange versionRange, String newMappingID, String newMappingSource, CancellationToken token)
at NuGet.PackageManagement.NuGetPackageManager.PreviewBuildIntegratedProjectActionsAsync(BuildIntegratedNuGetProject buildIntegratedProject, IEnumerable`1 nuGetProjectActions, INuGetProjectContext nuGetProjectContext, CancellationToken token)
at NuGet.PackageManagement.NuGetPackageManager.PreviewInstallPackageAsync(NuGetProject nuGetProject, PackageIdentity packageIdentity, ResolutionContext resolutionContext, INuGetProjectContext nuGetProjectContext, IEnumerable`1 primarySources, IEnumerable`1 secondarySources, VersionRange versionRange, CancellationToken token)
at NuGet.PackageManagement.NuGetPackageManager.PreviewInstallPackageAsync(NuGetProject nuGetProject, PackageIdentity packageIdentity, ResolutionContext resolutionContext, INuGetProjectContext nuGetProjectContext, IEnumerable`1 primarySources, IEnumerable`1 secondarySources, CancellationToken token)
at NuGet.PackageManagement.NuGetPackageManager.InstallPackageAsync(NuGetProject nuGetProject, PackageIdentity packageIdentity, ResolutionContext resolutionContext, INuGetProjectContext nuGetProjectContext, PackageDownloadContext downloadContext, IEnumerable`1 primarySources, IEnumerable`1 secondarySources, CancellationToken token)
at NuGet.PackageManagement.NuGetPackageManager.InstallPackageAsync(NuGetProject nuGetProject, PackageIdentity packageIdentity, ResolutionContext resolutionContext, INuGetProjectContext nuGetProjectContext, IEnumerable`1 primarySources, IEnumerable`1 secondarySources, CancellationToken token)
at JetBrains.ProjectModel.NuGet.Operations.NuGetInstallOperation.<>c__DisplayClass7_0.<<InstallAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at JetBrains.ProjectModel.NuGet.Operations.NuGetInstallOperation.InstallInternal(IProject project, String packageId, String packgeUserStr, NuGetFeedContext feedContext, Int32 nestedLevel, NuGetNotificationMode mode, NuGetOperationReporter reporter, Func`3 nativeInstall, NuGetProject givenNuGetProject)
@ Installing sdl2.nuget in TestProject finished (0.075 sec)
[Notification][Install] Install failed (project: TestProject, package: sdl2.nuget v2.30.0)
Object reference not set to an instance of an object.
NuGet works OK in VS2022…
Please sign in to leave a comment.
Hello Michał Sadowski,
Regrettably, you have encountered a known issue RIDER-77356. I'm afraid, the only workaround I can suggest at this time is to restore packages in VS.
Let me know if you have any questions.