fsprojects / ProjectScaffold

A prototypical .NET solution (file system layout and tooling), recommended for F# projects
http://fsprojects.github.io/ProjectScaffold
The Unlicense
515 stars 154 forks source link

When F# is not installed, error message is confusing to beginners #253

Closed rmunn closed 7 years ago

rmunn commented 8 years ago

Description

If someone new to F# tries to run the build.sh script on a Linux system where F# isn't installed yet, he may be confused by the resulting error messages.

Repro steps

  1. In a fresh Linux install, install git and mono-complete.
  2. Do not install fsharp.
  3. Clone the ProjectScaffold repo.
  4. Run build.sh.

    Expected behavior

An error message that would be easily comprehensible to F# beginners, like "It seems F# isn't installed on your system. To install it, you should install the 'fsharp' package, then re-run this build script." (Or even "Would you like us to install it for you?" and, if yes, run sudo apt-get install fsharp or sudo yum install fsharp or other package-manager commands as appropriate to the user's system. I think a simple "Please install this package via your system's package manager" message should be sufficient, though.)

Actual behavior

The error message that you actually get if you don't have F# installed is:

Running build failed.
Error:
Building /home/rmunn/code/TryScaffold/TryScaffold.sln failed with exitcode 1.
Status:        Failure
  1) Building /home/rmunn/code/TryScaffold/TryScaffold.sln failed with exitcode 1.
  2) : /home/rmunn/code/TryScaffold/src/TryScaffold/TryScaffold.fsproj(0,0): Target named 'Rebuild' not found in the project.
  3) : /home/rmunn/code/TryScaffold/tests/TryScaffold.Tests/TryScaffold.Tests.fsproj(0,0): /home/rmunn/code/TryScaffold/tests/TryScaffold.Tests/TryScaffold.Tests.fsproj: The required attribute "Project" in Import is empty

If I was an F# beginner, I would have no clue that "Target named 'Rebuild' not found in the project." and "The required attribute "Project" in Import is empty" were solvable by running sudo apt-get install fsharp. There is no obvious link between the error message and the solution.

Known workarounds

No workarounds; the problem is easily solved by installing the fsharp package, but since there's no clear error message to inform users of that fact, they won't know that.

Suggested fix

In build.sh, test for the presence of the relevant parts of the fsharp package. If they're missing, warn the user that the build may fail because the fsharp package appears not to be installed. Ask them to install that package and then re-run the build script.

Related information

daz10000 commented 7 years ago

Second this one - we lost many hours troubleshooting our CI build over this error message. If you're not super into MSBuild the message is quite undebuggable