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.

`<TargetFramework>netcore5.0</TargetFramework>` gives a gold bar

See original GitHub issue

Visual Studio Version: 16.9.0 Preview 3 [30828.3 main]

Summary: Change the project to have <TargetFramework>netcore5.0</TargetFramework> and you get an error that could be more helpful?

Steps to Reproduce:

  1. Create a regular C# .NET Core project.
  2. Double click on project, edit the TFM to any of these <TargetFramework>netcore6.0</TargetFramework> <TargetFramework>blah</TargetFramework>

–> you get nice errors in the error list like NETSDK1013 The TargetFramework value 'blah' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly. which is what I expect

  1. Edit it to <TargetFramework>netcore5.0</TargetFramework>

Now you get a gold bar The project 'ConsoleApp13' ran into a problem during the last operation: The expression "[System.Version]::Parse('')" cannot be evaluated. Version string portion was too short or too long. C:\Program Files\dotnet\sdk\5.0.200-preview.20614.14\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets You may need to reload the solution after fixing the problem.

image

The message isn’t ideal, but that probably comes from the .targets – the reason I’m logging it is that I wouldn’t expect a gold bar so maybe something’s wrong with the project system.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
marcpopMSFTcommented, Jul 1, 2021

I took a look and there is some specific code for a netcore50 TFM that was used a few years back for UAP10.0 applications. That TFM is deprecated. I could try to conditional the specific line causing the error but customers would still end up with error MSB3644. I could try to get make NETSDK1013 more restrictive but that would have to account for netcore5.0 being a valid TFM from a few years ago so I’m not sure how to best handle that.

So ultimately, it’s probably not worth fixing this at this time. We can reactivate if we get more feedback from customers who are doing netcore by mistake.

0reactions
danmoseleycommented, Jan 8, 2021

Got it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NET Core Web API 5.0 build errors
In my publish profile the Target Framework was set to NET5.0. Changed it to NET6.0 and the problem was gone.
Read more >
The TargetFramework value was not recognized. - .NET CLI
The SDK tries to parse the values provided in the project file for <TargetFramework> or <TargetFrameworks> into a well known value.
Read more >
Experimenting with .NET 5 Target Framework Names and the ...
What's interesting here is that the TargetFrameworkMoniker is actually .NETCoreApp. This means that net5.0, is actually the same as writing ...
Read more >
Problem with compiling my solution with .Net5 as the ...
0 " in the "TargetFrameworks" property of your project file and then re-run NuGet restore. My project file contains the correct target framework....
Read more >
Profile for Xamarin Inc.
Linknovate profile for Xamarin Inc. : Xamarin provides development tools to build and test native mobile apps, such as Xamarin Platform, Xamarin Test...
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