Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With dotnet core sdk F# projects, Visual Studio's NuGet package manager is confused about the version of FSharp.Core #3656

Closed
dhwed opened this issue Sep 27, 2017 · 13 comments

Comments

@dhwed
Copy link
Contributor

dhwed commented Sep 27, 2017

To reproduce:

mkdir NuGetBug
cd NuGetBug
dotnet new console -lang F#

A NuGetBug.fsproj is created:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Program.fs" />
  </ItemGroup>

</Project>

Open NuGetBug.fsproj in Visual Studio, right click the project, and 'Manage NuGet Packages...'

image

The Solution explorer shows that FSharp.Core 4.2.3 is installed, but the NuGet Package Manager UI shows the installed version of FSharp.Core as 4.2.0.

If you click the Update button, a PackageReference is added to the NuGetBug.fsproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Program.fs" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Update="FSharp.Core" Version="4.2.3" />
  </ItemGroup>

</Project>

But, the NuGet Package Manager UI still displays the installed version of FSharp.Core as 4.2.0.

By the way, I have been unable to figure out where the magic is that causes the FSharp.Core NuGet package to be implicitly added to all fsproj files - does anybody know how this is implemented?

@dsyme
Copy link
Contributor

dsyme commented Sep 27, 2017

By the way, I have been unable to figure out where the magic is that causes the FSharp.Core NuGet package to be implicitly added to all fsproj files - does anybody know how this is implemented?

@KevinRansom Is there any way we can just make this less magic? I know it was discussed but I can't remember the reason why we do it?

@KevinRansom
Copy link
Member

KevinRansom commented Sep 27, 2017

@dsyme
It's not magic, this way there is no need for the majority of projects to explicitly reference FSharp.Core, or System.ValueTuple.dll

To disable implicit FSharp.Core reference:

<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>

To specify a specific version of the FSharp.Core nuget package:

<FSharpCoreImplicitPackageVersion>4.2.3</FSharpCoreImplicitPackageVersion>

Similarly for System.ValueTuple.dll:

<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>

@dsyme
Copy link
Contributor

dsyme commented Sep 27, 2017

@KevinRansom But why don't we want to make this explicit by default? I mean, is it to make project files smaller? Or easier to shift to newer versions of F#? Just wondering

@dhwed
Copy link
Contributor Author

dhwed commented Sep 27, 2017

@KevinRansom Thanks, I can use those to fix my issue.

And you meant:

<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>

Out of curiosity, where is the FSharpCoreImplicitPackageVersion originally defined?

@KevinRansom
Copy link
Member

Simpler project files. And it doesn't make upgrading F# core harder.

Effectively the project file only needs to express the developer required customizations. And since all F# projects will need to specify an F# core it is not itself a customization.

Implicit FSharp.Core selection is specified as:

<FSharpCoreImplicitPackageVersion>4.2.*</FSharpCoreImplicitPackageVersion>

so we will automatically upgrade the project to the latest FSharp.Core, that matches the F# compiler.
This way the project says as little as the developer desires for upgrading FSharp.Core

We will not upgrade to 4.3.* until we upgrade the compiler anyway, ... reasons "versioning"

@KevinRansom
Copy link
Member

@dhwed
Copy link
Contributor Author

dhwed commented Sep 27, 2017

@KevinRansom Thanks again.

My understanding is that .NET Framework 4.7 includes System.ValueTuple in mscorlib, so I would not expect _FrameworkNeedsValueTupleReference to be true with a TargetFramework of net47.

Is this a mistake, or does .NET 4.7 actually need a System.ValueTuple NuGet package?

 

Also, it looks like the real problem here is that the NuGet Package Manager UI does not understand wildcard versions. If I put this into a csproj:

<PackageReference Include="FSharp.Core" Version="4.2.*" />

then I get the same problem where the Package Manager UI shows the installed version as 4.2.0 instead of the actual installed version of 4.2.3.

I'm not sure where to report this issue.

@KevinRansom
Copy link
Member

@dsyme there was a bug there. They put the type in mscorlib, but didn't include the shim, or add the reference to the framework. I believe 4.7.1 is the one where everything is fixed. Regardless ... most folk are going to be downlevel for quite a while. Hence the _FrameworkNeedsAValueTuple test.

@forki
Copy link
Contributor

forki commented Sep 27, 2017 via email

@rrelyea
Copy link

rrelyea commented Sep 27, 2017

@PatoBeltran - this is the issue you are looking to address (how floating versions show up in NuGet PM UI, right?)

@matthid
Copy link
Contributor

matthid commented Sep 27, 2017

Yes this issue seems to have been hijacked because of the last by the way sentence. the reported issue seems to be just a ui bug in how to report floating versions.

I'd assume C# has the same problem?
This is actually quite funny because what is the "installed" version? Nobody knows as it could change between showing in ui and running the application?

@PatoBeltran
Copy link

Yes, this issue is the same as NuGet/Home#3788 ... NuGet team is currently working on fixing it. Here is a link to the spec that gives more info on the proposed solution

@dhwed
Copy link
Contributor Author

dhwed commented Sep 27, 2017

Thanks everyone; I'm going to go ahead and close this issue since the root cause is already being tracked by the NuGet team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants