3

I am attempting to get started with F Sharp.

I have mono installed via brew and dotnetcore installed via d/l.

I have VS Code and the ionide plugin installed.

I have done the following steps:

  • project > new > expecto
  • paket install
  • fake build
  • expecto run

Install appears to occur with no errors. Build directory is empty after the fake build task. Expecto run does ... nothing.

When I open the generated Main.fs file, the editor tells me:

The namespace or module 'Expecto' is not defined

Is there something I am missing?

Toby Hede
  • 36,755
  • 28
  • 133
  • 162
  • 1
    I believe the Ionide template for "project > new > expecto" might be missing a file or two; it's been a while since I looked at it so I can't say for sure what's missing. I've had good success with https://github.com/TheAngryByrd/MiniScaffold which lets you do "dotnet new mini-scaffold" and have a working project structure that includes Expecto tests. (NOTE: If you don't have .Net Core 1.1, edit the two .fsproj files found in that template and remove the `netstandard1.6` and `netcoreapp1.1` lines from TargetFrameworks). – rmunn Mar 23 '18 at 07:42
  • 1
    Also note that there's a known issue currently with https://github.com/TheAngryByrd/MiniScaffold where if you don't have a Git repo, or if your Git repo doesn't have an `origin` remote, parts of the build will fail. After running `dotnet new mini-scaffold`, I always cd into the project and do the following four commands: `git init .`, `git add .`, `git commit -m "Initial commit from scaffold"`, and then `git remote add origin git@github.com:rmunn/non-existent-url` (or the real GitHub URL if I have one). Then it works just fine. – rmunn Mar 23 '18 at 07:45
  • 1
    Update: https://github.com/TheAngryByrd/MiniScaffold/pull/67 seems to have fixed the issue with needing an `origin` remote, so the only thing remaining is that the scaffold's build script expects there to be a git repo (because it puts the current Git hash into AssemblyInfo.fs). So just run `git init .` and do one commit (committing, say, the files that the scaffold produced) and you should be fine. – rmunn Mar 23 '18 at 07:46

1 Answers1

0

For future reference the fix if you are staying with the Ionide generated defaults is to make sure your target framework is set to .net core and not .net framework

<TargetFramework>netcoreapp2.0</TargetFramework>

Toby Hede
  • 36,755
  • 28
  • 133
  • 162