question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can no longer use TargetFrameworkIdentifier/TargetFrameworkVersion to specify framework

See original GitHub issue

Build 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

10reactions
davkeancommented, Aug 7, 2018

lol, thanks for chasing this down.

1reaction
nguerreracommented, Aug 7, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found