Ryan Lundy
Ryan Lundy

Reputation: 210090

'{{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?

Upvotes: 7

Views: 806

Answers (1)

Ryan Lundy
Ryan Lundy

Reputation: 210090

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.

Upvotes: 12

Related Questions