gpt4 book ai didi

c# - 使用旧解决方案将 nuget 包添加到 .net 核心项目时如何修复 $(NETStandardImplicitPackageVersion) 错误?

转载 作者:太空狗 更新时间:2023-10-29 20:35:54 26 4
gpt4 key购买 nike

我们有一个包含很多项目的现有 .NET 解决方案。我最近在解决方案中添加了一个新的 ASP.NET 核心项目。当我尝试将 Nuget 包添加到解决方案时,添加失败并且我在包管理器输出窗口中收到以下错误。如果我创建一个新的解决方案并将相同的项目添加到该解决方案,那么我就可以添加 Nuget 包,因此将新的 .NET 核心项目添加到现有解决方案似乎是一个问题。任何人都可以帮助我解决这个问题而无需重新创建解决方案吗?

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()<br/>
at System.Collections.Generic.List
1..ctor(IEnumerable1 collection)<br/>
at System.Linq.Enumerable.ToList[TSource](IEnumerable
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 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)

最佳答案

不确定这是否与我遇到的问题相同,但对我来说,解决它的方法是确保我的 sln 文件中的 GUID 匹配。

例如:

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

我必须用 PROJECT-GUID 替换 SOME-OTHER-GUID。

关于c# - 使用旧解决方案将 nuget 包添加到 .net 核心项目时如何修复 $(NETStandardImplicitPackageVersion) 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48382954/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com