I'm creating a new console project from scratch, by using vscode-ionide "F#: Create new Project".
After the project is succesfully created, I'm hitting https://github.com/ionide/ionide-vscode-fsharp/issues/498 that in turn redirects me to
To put this out of the way, I'm renaming .paket/paket.exe to .paket/paket.bootstrapper.exe, then running ./build.sh again.
This time ./paket/paket.exe is downloaded and the build process starts.
However, the build is failing with the following output:
./build.sh  ✓  4620  13:04:29
Checking Paket version (downloading latest stable)...
Paket.exe 5.100.2 is up to date.
Paket version 5.100.2
Last restore is still up to date.
Performance:
- Runtime: 1 second
Building project with version: LocalBuild
Shortened DependencyGraph for Target Build:
<== Build
<== Restore
<== InstallDotNetCLI
<== Clean
The running order is:
- Clean
- InstallDotNetCLI
- Restore
- Build
Running build with 1 worker
Starting Target: Clean
Deleting contents of ./build/
Finished Target: Clean
Starting Target: InstallDotNetCLI (==> Clean)
dotnet --version
dotnetcli 2.0.0 already installed in PATH
Finished Target: InstallDotNetCLI
Starting Target: Restore (==> InstallDotNetCLI)
dotnet restore
/Users/oscarvarto/gitRepos/fsharpWork/FSharpExercises/FSharpExercises/FSharpExercises.fsproj : error MSB4057: The target "Restore" does not exist in the project.
Running build failed.
Error:
System.Exception: dotnet restore failed
at [email protected] (System.String message) [0x00001] in <d64e5386b0d5458bbfcf3ea4c16b34d1>:0
at Microsoft.FSharp.Core.PrintfImpl+StringPrintfEnv`1[TResult].Finalize () [0x00012] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.PrintfImpl+Final1@224[TState,TResidue,TResult,A].Invoke (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] env, A a) [0x00038] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3253[T2,TResult,T1].Invoke (T2 u) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at FSI_0005.Build.runDotnet (System.String workingDir, System.String args) [0x00048] in <d64e5386b0d5458bbfcf3ea4c16b34d1>:0
at [email protected] (System.String p) [0x0000a] in <d64e5386b0d5458bbfcf3ea4c16b34d1>:0
at Microsoft.FSharp.Collections.SeqModule.Iterate[T] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] action, System.Collections.Generic.IEnumerable`1[T] source) [0x0002d] in <5893d081904cf4daa745038381d09358>:0
at [email protected] (Microsoft.FSharp.Core.Unit _arg3) [0x0000b] in <d64e5386b0d5458bbfcf3ea4c16b34d1>:0
at Fake.TargetHelper+targetFromTemplate@209-1[a].Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x00001] in <59b649fdccf1c534a7450383fd49b659>:0
at Fake.TargetHelper.runSingleTarget (Fake.TargetHelper+TargetTemplate`1[a] target) [0x0004b] in <59b649fdccf1c534a7450383fd49b659>:0
---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target Duration
------ --------
Clean 00:00:00.0016629
InstallDotNetCLI 00:00:00.2891931
Restore Failure
Total: 00:00:01.2069201
---------------------------------------------------------------------
Status: Failure
---------------------------------------------------------------------
---------------------------------------------------------------------
1) System.Exception: dotnet restore failed
at [email protected] (System.String message) [0x00001] in <d64e5386b0d5458bbfcf3ea4c16b34d1>:0
at Microsoft.FSharp.Core.PrintfImpl+StringPrintfEnv`1[TResult].Finalize () [0x00012] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.PrintfImpl+Final1@224[TState,TResidue,TResult,A].Invoke (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] env, A a) [0x00038] in <5893d081904cf4daa745038381d09358>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3253[T2,TResult,T1].Invoke (T2 u) [0x00001] in <5893d081904cf4daa745038381d09358>:0
at FSI_0005.Build.runDotnet (System.String workingDir, System.String args) [0x00048] in <d64e5386b0d5458bbfcf3ea4c16b34d1>:0
at [email protected] (System.String p) [0x0000a] in <d64e5386b0d5458bbfcf3ea4c16b34d1>:0
at Microsoft.FSharp.Collections.SeqModule.Iterate[T] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] action, System.Collections.Generic.IEnumerable`1[T] source) [0x0002d] in <5893d081904cf4daa745038381d09358>:0
at [email protected] (Microsoft.FSharp.Core.Unit _arg3) [0x0000b] in <d64e5386b0d5458bbfcf3ea4c16b34d1>:0
at Fake.TargetHelper+targetFromTemplate@209-1[a].Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x00001] in <59b649fdccf1c534a7450383fd49b659>:0
at Fake.TargetHelper.runSingleTarget (Fake.TargetHelper+TargetTemplate`1[a] target) [0x0004b] in <59b649fdccf1c534a7450383fd49b659>:0
---------------------------------------------------------------------
The important part (I think):
Starting Target: Restore (==> InstallDotNetCLI)
dotnet restore
/Users/oscarvarto/gitRepos/fsharpWork/FSharpExercises/FSharpExercises/FSharpExercises.fsproj : error MSB4057: The target "Restore" does not exist in the project.
Running build failed.
I have just confirmed the same error MSB4057: The target "Restore" does not exist in the project occurs in Windows 10.
The difference is that I am not hitting https://github.com/fsprojects/Paket/issues/2620 here (no need to rename paket.exe to paket.bootstrapper)
Just verified that a new console project works OK on a Ubuntu 16.04 LTS installation. Have no idea why the difference :/
The first time I got this kind of issue was a missing MSBUILD environment variable. The second time I got it was when I tried to use VS2017 version of msbuild with ionide.
@alanmbarr Thank you very much for giving me any clue.
I'll put some information about my Linux environment (the one that is working at the moment):
$ uname -a
Linux lap 4.10.0-35-generic #39~16.04.1-Ubuntu SMP Wed Sep 13 09:02:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ echo $PATH
/home/oscarvarto/anaconda3/bin:/usr/local/bin:/usr/local/sbin:/home/oscarvarto/bin:/home/oscarvarto/.local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/oscarvarto/idea/bin:/home/oscarvarto/bin/fake-dotnetcore
$ echo $FrameworkPathOverride
/usr/lib/mono/4.6.2-api/
$ echo $APPDATA
/home/oscarvarto
$ echo $LocalAppData
/home/oscarvarto
$ mono --version
Mono JIT compiler version 5.4.0.167 (tarball Wed Aug 23 20:22:55 UTC 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen (concurrent by default)
$ apt show fsharp
Package: fsharp
Version: 4.1.9-0xamarin11+ubuntu1404b1
Priority: optional
Section: cli-mono
Maintainer: Debian CLI Applications Team <[email protected]>
Installed-Size: 13.6 MB
Depends: mono-runtime (>= 3.0~), libfsharp-core4.3-cil (>= 4.1.9), libmono-corlib4.5-cil (>= 4.0.0~alpha1), libmono-system-core4.0-cil (>= 4.0.0~alpha1), libmono-system-io-compression4.0-cil (>= 3.2.1), libmono-system-numerics4.0-cil (>= 1.0), libmono-system-runtime4.0-cil (>= 2.10.1), libmono-system-windows-forms4.0-cil (>= 1.0), libmono-system4.0-cil (>= 4.0.0~alpha1), mono-xbuild (>= 1.0), libmono-compilerservices-symbolwriter4.0-cil, mono-devel (>= 4.0.0~)
Breaks: fsharp-console (<< 3.0.34+dfsg-3)
Replaces: fsharp-console (<< 3.0.34+dfsg-3)
Homepage: http://fsharp.org
Download-Size: 2 702 kB
APT-Manual-Installed: yes
APT-Sources: http://download.mono-project.com/repo/ubuntu alpha-xenial/main amd64 Packages
Description: functional-first programming language - compiler for the CLI
F# is a multi-paradigm programming language, supporting functional,
imperative, and object-oriented structures.
.
This package contains an F# compiler targeting the CLI runtime.
N: There is 1 additional record. Please use the '-a' switch to see it
$ which fake
/home/oscarvarto/bin/fake-dotnetcore/fake
$ which paket
/usr/local/bin/paket
$ fake --version
FakePath: /home/oscarvarto/bin/fake-dotnetcore/Fake.Runtime.dll
FAKE - F# Make "5.0.0"
$ paket --version
Paket version 5.100.2
I will edit this later with more information on these environments:
According to the ionide documents you must use the visual studio 2015 build tools for windows. msbuild tools for vs2017 will not work
Try refreshing templates (F#: Refresh Templates command) and try create projects again, I believe we fixed those bugs in Forge some time ago.... Also latest Ionide update should contain latest templates, so I hope it's all fixed now.
@Krzysztof-Cieslak Updating to latest Ionide-fsharp 3.2.0 solved the problem on both Mac OS X and Windows 10 for me.
I really appreciate your hard work on Ionide. At least for me, it provides me with a very important tool to work with F# crossplatform.
This represents for me (and I guess some others too) that F# is a more attractive choice for a general purpose programming language.
Most helpful comment
@Krzysztof-Cieslak Updating to latest Ionide-fsharp 3.2.0 solved the problem on both Mac OS X and Windows 10 for me.
I really appreciate your hard work on Ionide. At least for me, it provides me with a very important tool to work with F# crossplatform.
This represents for me (and I guess some others too) that F# is a more attractive choice for a general purpose programming language.