Can no longer use TargetFrameworkIdentifier/TargetFrameworkVersion to specify framework
See original GitHub issueBuild the following:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworkIdentifer>.NETFramework</TargetFrameworkIdentifer>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
</Project>
Expected: No error Actual:
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. ConsoleApp197 C:\Program Files\dotnet\sdk\2.1.400\Sdks\Microsoft.Net.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 96
Error MSB4018 The "ResolvePackageAssets" task failed unexpectedly.
NuGet.Frameworks.FrameworkException: Invalid framework identifier ''.
at NuGet.Frameworks.NuGetFramework.GetShortFolderName(IFrameworkNameProvider mappings)
at Microsoft.NET.Build.Tasks.LockFileExtensions.GetTargetAndThrowIfNotFound(LockFile lockFile, NuGetFramework framework, String runtime)
at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheWriter..ctor(ResolvePackageAssets task, Stream stream)
at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.CreateReaderFromDisk(ResolvePackageAssets task, Byte[] settingsHash)
at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader..ctor(ResolvePackageAssets task)
at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups()
at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore()
at Microsoft.NET.Build.Tasks.TaskBase.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() ConsoleApp197 C:\Program Files\dotnet\sdk\2.1.400\Sdks\Microsoft.Net.Sdk\targets\Microsoft.PackageDependencyResolution.targets 198
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
The TargetFramework value was not recognized. - .NET CLI
If the value is not recognized, the TargetFrameworkIdentifier or TargetFrameworkVersion value may be set to an empty string or Unsupported .
Read more >NETSDK1013: The TargetFramework value 'v4.7.2' was not ...
I am running unit tests on a .NET project against a specific version of .NET framework and I am using following command:
Read more >Visual Studio error when trying to publish .NET Core app ...
The TargetFramework value “” was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion ...
Read more >NRE on restore when project does not have target framework set
I had a project without target framework set (due to a Directory. ... If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties ...
Read more >Experimenting with .NET 5 Target Framework Names and the ...
Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
lol, thanks for chasing this down.
OK, TargetFrameworkIdentifier is misspelled as TargetFrameworkIdentifer in the repro. :trollface:
With the typo fixed, this works as expected. 😄
On the command line, the error message could maybe be refined, but it is correct – you have and empty TargetFramework AND you did not in specify both TargetFrameworkIdentifier and TargetFrameworkVersion.
The crash when the TFM is invalid in ResolvePackageAssets during design time builds is #2363, so closing this as a duplicate of that.