VScode/Ionide namespaces don't work

I wrote my first project using VS2019, but for the rest of my F# work I wanted to try and use dotnet core and VSCode.

I followed the directions on this site’s getting started for VSCode, getting Ionide installed and all that.

I used the dotnet tool to create a simple console application template for F#. So far so good.
But I can’t seem to get it to understand open. I want to
open System.Security.Principal

but when I try to use, say, WindowsIdentity.GetCurrent().Token or something, it acts like it doesn’t know what I’m talking about.

I found out through some digging that apparently I have to manually install even System namespace packages into my project. Okay, fine. I did that with

dotnet add package System.Security.Principal

and it seemed to pull down a bunch of stuff and install. The package shows up in my project file. It also seemed to automatically ‘restore’ (whatever that means) my project.
Having done all that…it still doesn’t work.

Why is this difficult? All of this just worked in VStudio. I get that VSCode is more componentized and all that, but something as basic as opening a package shouldn’t be silly like this. What mystic incantation am I omitting to get this to work like a normal project?

I seem to have made headway.

It seems you have to give the precise right name to the thing you want to import. The tool won’t resolve the assembly correctly for you.

So even though dotnet did…something(?), when I added the System.Security.Principal package, whatever it did wasn’t the right thing. I had to tell it to use the System.Security.Principal.Windows package. I was apparently supposed to know that by looking at the API reference on MSDN.

After doing that, a new line was added to the project file, and the needed namespace started resolving.

This is just…odd. Why did dotnet appear to do something the first time when it actually did nothing? Can’t it resolve the correct assembly name for me?

I dunno. Not impressed with it so far, but at least I can actually try things now.