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.

Cannot build net7.0 with FSharp.Compiler.Service 42.7.100

See original GitHub issue

Cannot build net7.0 with FSharp.Compiler.Service 42.7.100

Repro steps

With the latest Visual Studio 17.4 and its .NET 7 SDK and templates, in a new folder with the test project name invoke:

dotnet new console -lang f#

It creates the net7.0 console app F# project. Then add the latest FSharp.Compiler.Service 42.7.100:

dotnet add package FSharp.Compiler.Service --version 42.7.100

It fails:

> dotnet add package FSharp.Compiler.Service --version 42.7.100
  Determining projects to restore...
  Writing C:\TEMP\TEMP\tmp1BB9.tmp
info : X.509 certificate chain validation will use the default trust store selected by .NET.
info : X.509 certificate chain validation will use the default trust store selected by .NET.
info : Adding PackageReference for package 'FSharp.Compiler.Service' into project 'C:\tmp\_221109_0646\_221109_0646.fsproj'.
info : Restoring packages for C:\tmp\_221109_0646\_221109_0646.fsproj...
info :   CACHE https://api.nuget.org/v3-flatcontainer/microsoft.build.framework/index.json
info :   CACHE https://api.nuget.org/v3-flatcontainer/microsoft.build.tasks.core/index.json
info :   CACHE https://api.nuget.org/v3-flatcontainer/microsoft.build.utilities.core/index.json
error: NU1102: Unable to find package Microsoft.Build.Framework with version (>= 17.4.0-preview-22469-04)
error:   - Found 42 version(s) in nuget.org [ Nearest version: 17.3.2 ]
error:   - Found 0 version(s) in MyNuGet
error:   - Found 0 version(s) in Microsoft Visual Studio Offline Packages
error:   - Found 0 version(s) in C:\Program Files\dotnet\sdk\7.0.100\FSharp\library-packs
error: NU1102: Unable to find package Microsoft.Build.Tasks.Core with version (>= 17.4.0-preview-22469-04)
error:   - Found 42 version(s) in nuget.org [ Nearest version: 17.3.2 ]
error:   - Found 0 version(s) in MyNuGet
error:   - Found 0 version(s) in Microsoft Visual Studio Offline Packages
error:   - Found 0 version(s) in C:\Program Files\dotnet\sdk\7.0.100\FSharp\library-packs
error: NU1102: Unable to find package Microsoft.Build.Utilities.Core with version (>= 17.4.0-preview-22469-04)
error:   - Found 42 version(s) in nuget.org [ Nearest version: 17.3.2 ]
error:   - Found 0 version(s) in MyNuGet
error:   - Found 0 version(s) in Microsoft Visual Studio Offline Packages
error:   - Found 0 version(s) in C:\Program Files\dotnet\sdk\7.0.100\FSharp\library-packs
error: Package 'FSharp.Compiler.Service' is incompatible with 'all' frameworks in project 'C:\tmp\_221109_0646\_221109_0646.fsproj'.

To work around, add this reference manually to the project file:

  <ItemGroup>
    <PackageReference Include="FSharp.Compiler.Service" Version="42.7.100" />
  </ItemGroup>

and build

dotnet build

It fails due to not found Microsoft.Build.* packages:

> dotnet build
MSBuild version 17.4.0+18d5aef85 for .NET
  Determining projects to restore...
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102: Unable to find package Microsoft.Build.Framework with version (>= 17.4.0-preview-22469-04)
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102:   - Found 42 version(s) in nuget.org [ Nearest version: 17.3.2 ]
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102:   - Found 0 version(s) in MyNuGet
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102:   - Found 0 version(s) in Microsoft Visual Studio Offline Packages
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102:   - Found 0 version(s) in C:\Program Files\dotnet\sdk\7.0.100\FSharp\library-packs
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102: Unable to find package Microsoft.Build.Tasks.Core with version (>= 17.4.0-preview-22469-04)
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102:   - Found 42 version(s) in nuget.org [ Nearest version: 17.3.2 ]
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102:   - Found 0 version(s) in MyNuGet
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102:   - Found 0 version(s) in Microsoft Visual Studio Offline Packages
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102:   - Found 0 version(s) in C:\Program Files\dotnet\sdk\7.0.100\FSharp\library-packs
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102: Unable to find package Microsoft.Build.Utilities.Core with version (>= 17.4.0-preview-22469-04)
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102:   - Found 42 version(s) in nuget.org [ Nearest version: 17.3.2 ]
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102:   - Found 0 version(s) in MyNuGet
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102:   - Found 0 version(s) in Microsoft Visual Studio Offline Packages
C:\tmp\_221109_0646\_221109_0646.fsproj : error NU1102:   - Found 0 version(s) in C:\Program Files\dotnet\sdk\7.0.100\FSharp\library-packs
  Failed to restore C:\tmp\_221109_0646\_221109_0646.fsproj (in 271 ms).

Build FAILED.

Expected behavior

All the above commands should work and build an app, as a result.

Actual behavior

Some commands fail as described.

Known workarounds

None.

Related information

  • Operating system - Windows 10
  • .NET Runtime kind - net7.0
  • Editing Tools - Visual Studio 17.4

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nightromancommented, Nov 14, 2022

New FCS 42.7.101 works, thank you!

0reactions
nightromancommented, Nov 12, 2022

FWIW it looks like the required Microsoft.Build.* packages 17.4+ are not available on NuGet.

Microsoft.Build.* packages 17.4 are available on NuGet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FSharp.Compiler.Service uses latest TargetFramework ...
I am using FSharp.Compiler.Service to compile user created F# scripts. Up until today, the code was working as expected however after I updated ......
Read more >
FSharp.Compiler.Service 43.7.400
Version Downloads Last updated 43.8.100‑preview.23371.8 80 12 days ago 43.8.100‑preview.23327.15 122 a month ago 43.7.400 530 12 days ago
Read more >
How to directly invoke F# compiler on .NET Core?
I want to invoke F# compiler (i.e. fsc) from .NET Core SDK directly. I know about dotnet build & co, but I don't...
Read more >
My F# compiler scripts
Compiler.Service project, you can break the public API of the binary. For me, this happens frequently when I touch SyntaxTree.fsi .
Read more >
Is Microsoft serious about F#? : r/fsharp
I assume FSAC is just misusing the F# Compiler Service, I can't imagine analysis of a medium size project requires over 1GB of...
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