This came up while trying to load a disassembled project that was then reassembled with dnSpy, but you may find it for other reasons.
If you encounter this error:
C:\Users\Me\source\repos\MyRecompiledProject.Web\MyRecompiledProject.Web.csproj : error : A numeric comparison was attempted on "$(_TargetFrameworkVersionWithoutV)" that evaluates to "" instead of a number, in condition "('$(TargetFrameworkIdentifier)' != '.NETCoreApp' OR '$(_TargetFrameworkVersionWithoutV)' < '3.0') AND ('$(TargetFrameworkIdentifier)' != '.NETStandard' OR '$(_TargetFrameworkVersionWithoutV)' < '2.1')". C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets
Or, here it is wrapped:
C:\Users\Me\source\repos\MyRecompiledProject.Web\MyRecompiledProject.Web.csproj :
error :
A numeric comparison was attempted on "$(_TargetFrameworkVersionWithoutV)"
that evaluates to "" instead of a number, in condition
"('$(TargetFrameworkIdentifier)' != '.NETCoreApp' OR
'$(_TargetFrameworkVersionWithoutV)' < '3.0') AND
('$(TargetFrameworkIdentifier)' != '.NETStandard' OR
'$(_TargetFrameworkVersionWithoutV)' < '2.1')".
C:\Program Files (x86)\Microsoft Visual Studio\2019\
Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets
Or here's the image:
I found a clue to the solution on this website in some other language:
Here's how you fix it. Open up the .csproj file, and near the top you'll see these two lines:
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>
Modify the first line (remove the "v"), and insert the second line, so it looks like this:
<TargetFrameworkVersion>5.0</TargetFrameworkVersion>
<_TargetFrameworkVersionWithoutV>5.0</_TargetFrameworkVersionWithoutV>
<TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>
Load the project as you were, and it should work.
Note, one time I reloaded the project, I got an error message, but it still worked, not sure what was different, but another time I got no error message. Your mileage may vary.