Details about Problem
I am trying to build one of the project for Linux operating system and it fails with the .NET SDK 5.0. My main concern is about the obscure error message displayed which does not give any indication of the project file (csproj) or the target framework which is the source of issue here.
$ dotnet --info
.NET SDK (reflecting any global.json):
Version: 5.0.101
Commit: d05174dc5a
Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /usr/share/dotnet/sdk/5.0.101/
Host (useful for support):
Version: 5.0.1
Commit: b02e13abab
.NET SDKs installed:
5.0.101 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
It is probably this https://github.com/NuGet/NuGet.Client/blob/release-5.8.x/src/NuGet.Core/NuGet.Frameworks/NuGetFramework.cs#L260 which is the source of issue. It doesn't give the current project file being processed or what was the string present as part of the target framework. It is a source of concern since it becomes much harder to debug such issues for big projects.
Did not work ever for my project.
Detailed repro steps so we can see the same problem
Restoration of the project via "dotnet restore" fails with obscure message.
2>/usr/share/dotnet/sdk/5.0.101/NuGet.targets(131,5): error : Invalid framework identifier ''. [/home/neeraj/someproj/build.proj]
NuGet.Frameworks.FrameworkException: Invalid framework identifier ''.
at NuGet.Frameworks.NuGetFramework.GetShortFolderName(IFrameworkNameProvider mappings)
at NuGet.Frameworks.NuGetFramework.GetShortFolderName()
at NuGet.Commands.MSBuildRestoreUtility.<>c__DisplayClass6_0.<GetPackageSpec>b__0(TargetFrameworkInformation tfi)
at NuGet.Shared.Extensions.ForEach[T](IEnumerable`1 enumeration, Action`1 action)
at NuGet.Commands.MSBuildRestoreUtility.GetPackageSpec(IEnumerable`1 items)
at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at NuGet.Commands.MSBuildRestoreUtility.GetDependencySpec(IEnumerable`1 items)
at NuGet.Build.Tasks.RestoreTask.ExecuteAsync(ILogger log)
Done executing task "RestoreTask" -- FAILED.
Sample Project
Its a proprietary project, so cannot provide the code here.
Details about Problem
I am trying to build one of the project for Linux operating system and it fails with the .NET SDK 5.0. My main concern is about the obscure error message displayed which does not give any indication of the project file (csproj) or the target framework which is the source of issue here.
It is probably this https://github.com/NuGet/NuGet.Client/blob/release-5.8.x/src/NuGet.Core/NuGet.Frameworks/NuGetFramework.cs#L260 which is the source of issue. It doesn't give the current project file being processed or what was the string present as part of the target framework. It is a source of concern since it becomes much harder to debug such issues for big projects.
Detailed repro steps so we can see the same problem
Restoration of the project via "dotnet restore" fails with obscure message.
Sample Project