Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'{{FSharpCoreShippedPackageVersion}}' is not a valid version string

I just upgraded to Visual Studio 2019 version 16.5.0 Preview 2.0. It seems to have broken building and running .NET Core projects in F# with the dotnet command line tool.

Previously dotnet build and dotnet run worked fine. Now either one produces this error message (wrapped for readability):

C:\Program Files\dotnet\sdk\3.1.200-preview-014883\NuGet.targets(124,5):
  error : '{{FSharpCoreShippedPackageVersion}}' is not a valid version string.

My projects don't have the string FSharpCoreShippedPackageVersion anywhere in them that I can see (including in the .fsproj files). I also looked in the referenced NuGet.targets file and couldn't find FSharpCoreShippedPackageVersion in it either.

Using dotnet new console --language=F# also fails, telling me to restore NuGet packages, but attempting dotnet restore gives the same error message.

What can I do to fix this?

like image 523
Ryan Lundy Avatar asked Jan 23 '20 09:01

Ryan Lundy


1 Answers

UPDATE: This issue appears to be fixed in the current version of the preview:

3.1.200-preview-014977

If you update Visual Studio 2019 Preview, you shouldn't need this workaround anymore.


I found a workaround:

  1. Run dotnet new globaljson in the project root folder
  2. Edit the global.json to use .NET Core 3.1.101 instead of 3.1.200-preview-014883.

It appears that the combination of VS 2019 Version 16.5.0 Preview 2.0 and .NET Core 3.1.200-preview-014883 causes this problem.

like image 187
Ryan Lundy Avatar answered Oct 20 '22 07:10

Ryan Lundy