We have an existing .NET Solution with a lot of projects. I've recently added a new ASP.NET core project to the solution. When I try to add a Nuget package to the solution, the add fails and I get the following error in the Package Manager output window. If I create a new solution and add the same project to the solution then I'm able to add Nuget packages so it seems to be an issue with adding new .NET core projects to an existing solution. Can anyone help me get past this without needing to recreate the solution?
System.ArgumentException: '$(NETStandardImplicitPackageVersion)' is not a valid version string. at NuGet.Versioning.VersionRange.Parse(String value, Boolean allowFloating) at
NuGet.PackageManagement.VisualStudio.VsManagedLanguagesProjectSystemServices.ToPackageLibraryDependency(PackageReference reference) at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
1..ctor(IEnumerable
at System.Collections.Generic.List1 collection)
1 source) at NuGet.PackageManagement.VisualStudio.VsManagedLanguagesProjectSystemServices.d__23.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 System.Linq.Enumerable.ToList[TSource](IEnumerable
at NuGet.PackageManagement.VisualStudio.LegacyPackageReferenceProject.d__27.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.VisualStudio.LegacyPackageReferenceProject.d__14.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.d__6.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.d__2.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.d__75.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
Not sure if this is the same issue as the one I encountered, but, for me, what fixed it was making sure the GUIDs I had in my sln file matched.
For example:
Project("{PROJECT-GUID}") = "ProjectA", "ProjectA\ProjectA.csproj", "{GUID-PROJECT-A}"
EndProject
Project("{PROJECT-GUID}") = "ProjectB", "ProjectB\ProjectB.csproj", "{GUID-PROJECT-B}"
EndProject
Project("{SOME-OTHER-GUID}") = "ProjectC", "ProjectC\ProjectC.csproj", "{GUID-PROJECT-C}"
EndProject
I had to replace SOME-OTHER-GUID with PROJECT-GUID.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With