You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During MSBuild restore, I got the "Invalid framework identifier" error. This issue is not about the reasons for the error, but rather that the error is lacking information about what project caused it in the first place. I'm requesting that this error message also prints the path of the project its investigating when the error occurred.
I'm working in a repo with hundreds of C# projects, and I'm trying to set a default <TargetFramework> property across many of them. Obviously, at least one of these projects didn't receive the default value correctly, but which one?
Verbose Logs
NuGet.RestoreEx.targets(19,5): error : Invalid framework identifier ''. [...]
NuGet.RestoreEx.targets(19,5): error : at NuGet.Frameworks.NuGetFramework.GetShortFolderName(IFrameworkNameProvider mappings) [...]
NuGet.RestoreEx.targets(19,5): error : at NuGet.ProjectModel.PackageSpecWriter.WriteMetadataTargetFrameworks(IObjectWriter writer, ProjectRestoreMetadata msbuildMetadata) [...]
NuGet.RestoreEx.targets(19,5): error : at NuGet.ProjectModel.PackageSpecWriter.SetMSBuildMetadata(IObjectWriter writer, PackageSpec packageSpec) [...]
NuGet.RestoreEx.targets(19,5): error : at NuGet.ProjectModel.PackageSpecWriter.Write(PackageSpec packageSpec, IObjectWriter writer, Boolean hashing) [...]
NuGet.RestoreEx.targets(19,5): error : at NuGet.ProjectModel.DependencyGraphSpec.Write(IObjectWriter writer, Boolean hashing, Action`3 writeAction) [...]NuGet.RestoreEx.targets(19,5): error : at NuGet.ProjectModel.DependencyGraphSpec.GetHash() [...]NuGet.RestoreEx.targets(19,5): error : at NuGet.Commands.RestoreCommand.EvaluateCacheFile() [...]NuGet.RestoreEx.targets(19,5): error : at NuGet.Commands.RestoreCommand.<ExecuteAsync>d__45.MoveNext() [...]NuGet.RestoreEx.targets(19,5): error : --- End of stack trace from previous location where exception was thrown --- [...]NuGet.RestoreEx.targets(19,5): error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [...]NuGet.RestoreEx.targets(19,5): error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [...]NuGet.RestoreEx.targets(19,5): error : at NuGet.Commands.RestoreRunner.<ExecuteAsync>d__7.MoveNext() [...]NuGet.RestoreEx.targets(19,5): error : --- End of stack trace from previous location where exception was thrown --- [...]NuGet.RestoreEx.targets(19,5): error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [...]NuGet.RestoreEx.targets(19,5): error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [...]NuGet.RestoreEx.targets(19,5): error : at NuGet.Commands.RestoreRunner.<ExecuteAndCommitAsync>d__6.MoveNext() [...]NuGet.RestoreEx.targets(19,5): error : --- End of stack trace from previous location where exception was thrown --- [...]NuGet.RestoreEx.targets(19,5): error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [...]NuGet.RestoreEx.targets(19,5): error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [...]NuGet.RestoreEx.targets(19,5): error : at NuGet.Commands.RestoreRunner.<CompleteTaskAsync>d__9.MoveNext() [...]NuGet.RestoreEx.targets(19,5): error : --- End of stack trace from previous location where exception was thrown --- [...]NuGet.RestoreEx.targets(19,5): error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [...]NuGet.RestoreEx.targets(19,5): error : at NuGet.Commands.RestoreRunner.<RunAsync>d__2.MoveNext() [...]NuGet.RestoreEx.targets(19,5): error : --- End of stack trace from previous location where exception was thrown --- [...]NuGet.RestoreEx.targets(19,5): error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [...]NuGet.RestoreEx.targets(19,5): error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [...]NuGet.RestoreEx.targets(19,5): error : at NuGet.Commands.RestoreRunner.<RunAsync>d__0.MoveNext() [...]NuGet.RestoreEx.targets(19,5): error : --- End of stack trace from previous location where exception was thrown --- [...]NuGet.RestoreEx.targets(19,5): error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [...]NuGet.RestoreEx.targets(19,5): error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [...]NuGet.RestoreEx.targets(19,5): error : at NuGet.Build.Tasks.BuildTasksUtility.<RestoreAsync>d__12.MoveNext() [...]NuGet.RestoreEx.targets(19,5): error : --- End of stack trace from previous location where exception was thrown --- [...]NuGet.RestoreEx.targets(19,5): error : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [...]NuGet.RestoreEx.targets(19,5): error : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [...]NuGet.RestoreEx.targets(19,5): error : at NuGet.Build.Tasks.Console.MSBuildStaticGraphRestore.<RestoreAsync>d__14.MoveNext() [...]
The text was updated successfully, but these errors were encountered:
@svew Thanks for reporting the issue. It would be good to improve the error messaging to help identify which project is having the issue. Can you please provide a minimal example solution that reproduces the Invalid framework identifier error so we can reproduce the issue and look into improving the messaging? Thanks!
Removing the TargetFramework altogether results in a different error message (https://learn.microsoft.com/en-us/dotnet/core/tools/sdk-errors/netsdk1013):
error NETSDK1013: The TargetFramework value '' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly.
That error seems to describe that scenario well and specifies the project where the issue occurs. What we would like to find is a repro for the Invalid framework identifier '' error you were seeing. Please let us know if you find a repro for that issue so we can pinpoint the issue.
NuGet Product Used
MSBuild.exe
Product Version
MSBuild: 17.6.3.22601
Worked before?
No response
Impact
None
Repro Steps & Context
During MSBuild restore, I got the "Invalid framework identifier" error. This issue is not about the reasons for the error, but rather that the error is lacking information about what project caused it in the first place. I'm requesting that this error message also prints the path of the project its investigating when the error occurred.
I'm working in a repo with hundreds of C# projects, and I'm trying to set a default
<TargetFramework>
property across many of them. Obviously, at least one of these projects didn't receive the default value correctly, but which one?Verbose Logs
The text was updated successfully, but these errors were encountered: