Getting started with F# Visual Studio 2022

Good Morning,

I just watched a bunch of WDC videos on F# and decided to give it a go. I downloaded a fresh offline install of Visual Studio 2022 and put it on my lab computer. I fired up a first Hello World app, and it does not compile. I tried googling the error to lots of answers for computers with an online connection.

Does anyone have a good getting started guide to setting up an offline lab for F#?

Could you share what the compiler error is? (And perhaps also the code?)

This is the code

// Learn more about F# at http://fsharp.org

open System

[<EntryPoint>]
let main argv =
    printfn "Hello World from F#!"
    0 // return an integer exit code

This is the error

Severity	Code	Description	Project	File	Line	Suppression State
Error	NETSDK1004	Assets file 'C:\Users\OfflineLab\source\repos\ConsoleApp3\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.	ConsoleApp3	C:\Program Files\dotnet\sdk\6.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets	267	

Rerun the Visual Studio installer and modify the installation. Under the installation details for .NET Desktop Development make sure “F# desktop language support” is ticked as you’re trying to make a desktop/console type project. I suspect that will help as I always create and build a console app after every VS install with no problems unless I missed that step.

I’ve tried asking the VS team to enable this by default but they won’t for ‘reasons’. But they should so that people like you don’t have issues when they go to try out F#.

1 Like