Search code examples
.netxamarinf#target-framework

F# for Xamarin MacOS X : TargetFrameworkVersionv4.5.2 not supported by this toolset (ToolsVersion4.0)


I've been using F# on VS2015, but i bought my first (new) iMAC running on MacOS X 10.11.3 and installed Xamarin 6.0 (alpha release). i am encoutering some problems when i want to compile a file which is ok under VS2015.

I've got warnings at compilation

TargetFrameworkVersionv4.5.2 not supported by this toolset (ToolsVersion4.0) 

this is for the file Microsoft.Common.Targets

..../Library/Frameworks/Mono.Frameworks/Version/4.4.0/Lib/Mono/4.5/Microsoft.Common.Targets

and at runtime i got error

at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, System.String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) [0x00000] in /private/tmp/source-mono-4.4.0/bockbuild-mono-4.4.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.IO/FileStream.cs:152 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool)
  at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost) [0x00065] in /private/tmp/source-mono-4.4.0/bockbuild-mono-4.4.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/mscorlib/system/io/streamreader.cs:240 
  at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) [0x00000] in /private/tmp/source-mono-4.4.0/bockbuild-mono-4.4.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/mscorlib/system/io/streamreader.cs:221 
  at System.IO.StreamReader..ctor (System.String path, Boolean detectEncodingFromByteOrderMarks) [0x00000] in /private/tmp/source-mono-4.4.0/bockbuild-mono-4.4.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/mscorlib/system/io/streamreader.cs:202 
  at System.IO.StreamReader..ctor (System.String path) [0x00000] in /private/tmp/source-mono-4.4.0/bockbuild-mono-4.4.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/external/referencesource/mscorlib/system/io/streamreader.cs:182 
  at (wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor (string)
  at System.IO.File.OpenText (System.String path) [0x00000] in /private/tmp/source-mono-4.4.0/bockbuild-mono-4.4.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.IO/File.cs:346 
  at System.IO.File.ReadAllLines (System.String path) [0x00000] in /private/tmp/source-mono-4.4.0/bockbuild-mono-4.4.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.IO/File.cs:515 
  at <StartupCode$Algo_Stanford>.$Knapsack_big.main@ () [0x0000d] in /Users/francois-guillaume.rideau/Documents/Learning-Fsharp/Algo Stanford/Algo Stanford/Knapsack_big.fs:20 

what should I do ?

thanks


Solution

  • Please change target framework to .NET 4.5, as Mono 4.x does not support 4.5.2 yet.