Bug 37978 - Can't create any new F# projects if F# version in the system is 3.0
Summary: Can't create any new F# projects if F# version in the system is 3.0
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: F# Add-in ()
Version: Trunk
Hardware: PC Windows
: Normal normal
Target Milestone: (C8)
Assignee: Dave Thomas
URL:
Depends on:
Blocks:
 
Reported: 2016-01-25 06:30 UTC by Andres G. Aragoneses
Modified: 2016-03-14 04:20 UTC (History)
6 users (show)

Tags: BZCU
Is this bug a regression?: ---
Last known good build:


Attachments
logs requested (109.89 KB, text/plain)
2016-01-25 10:23 UTC, Andres G. Aragoneses
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Andres G. Aragoneses 2016-01-25 06:30:25 UTC
Just downloaded XS6.0 Preview 3 (build 3668) for Windows and:

1. File -> New -> Solution
2. Choose "Other -> .NET" in the left panel.
3. "Console Project" will be highlighted in the list.
4. Choose F# language on the combobox.
5. Click on Next button, give a name for solution and project.
6. Click Create button.

Current results:
Nothing happens, clicking on "Create" button doesn't have any effect at all (NOTE: for C# projects, this works fine).

Expected results:
Should create F# project.
Comment 1 Matt Ward 2016-01-25 10:03:14 UTC
Can you attach the IDE logs? If the new project dialog is not getting passed the Create button click then an exception is most likely being thrown and it should be logged.
Comment 2 Andres G. Aragoneses 2016-01-25 10:04:36 UTC
> Can you attach the IDE logs?

Sure, where are the logs located in a Windows8.1 OS?
Comment 3 Matt Ward 2016-01-25 10:08:03 UTC
I always use Help - Open Log Directory to find the logs.
Comment 4 Andres G. Aragoneses 2016-01-25 10:23:31 UTC
Created attachment 14709 [details]
logs requested

> I always use Help - Open Log Directory to find the logs.

Cool! Thanks for the tip. I'm attaching the file which seems relevant to this. I'm guessing the culprit is this:

ERROR [2016-01-25 13:04:37Z]: An unhandled exception has occured. Terminating Xamarin Studio? False
System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

See the file for the whole stack trace.
Comment 5 Andres G. Aragoneses 2016-01-25 10:24:17 UTC
(NOTE: I can create F# projects fine with VisualStudio, which is also installed in this box.)
Comment 6 Matt Ward 2016-01-25 10:37:04 UTC
Yes that seems to be the cause of the failure to create the F# project. With the full callstack you can see the New Project dialog trying to get the code dom provider from the F# language binding and the FSharp.Core assembly cannot be resolved. 

On my machine it works since I have F# 3.1 installed so it finds FSharp.Core:

C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.1.0\FSharp.Core.dll

I could update the New Project dialog so the project can still be created although I suspect other parts would then fail when Xamarin Studio tries to use the F# addin.

It would be good if Xamarin Studio could detect that F# 3.1 is not installed and indicate that this is the problem.
Comment 7 Andres G. Aragoneses 2016-01-25 10:41:18 UTC
> On my machine it works since I have F# 3.1 installed so it finds FSharp.Core:

In my machine, FSharp.Core.dll is here:

C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\3.0\Runtime\v4.0


> It would be good if Xamarin Studio could detect that F# 3.1 is not
> installed and indicate that this is the problem.

Does XS require F# 3.1? Why wouldn't it be compatible with F# 3.0? VisualStudio can :-/
Comment 8 Jason Imison 2016-01-27 16:42:30 UTC
Andres, what does your fsproj look like?

It should look like this :-

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProjectGuid>{7893ADC1-6851-4961-8D00-064FFBFDAE2A}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <RootNamespace>fsconsole30</RootNamespace>
    <AssemblyName>fsconsole30</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug</OutputPath>
    <DefineConstants>DEBUG</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <ExternalConsole>true</ExternalConsole>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <Optimize>true</Optimize>
    <OutputPath>bin\Release</OutputPath>
    <DefineConstants></DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <ExternalConsole>true</ExternalConsole>
    <GenerateTailCalls>true</GenerateTailCalls>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="mscorlib" />
    <Reference Include="FSharp.Core" />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Numerics" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.fs" />
    <Compile Include="Program.fs" />
  </ItemGroup>
  <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" />
</Project>

The template looks to see if 3.1 or 3.0 is installed and chooses the appropriate Microsoft.FSharp.Targets file. There isn't a specific version of FSharp.Core required.

Do you have any other folders in C:\Program Files (x86)\Microsoft SDKs\F# ?
Comment 9 Andres G. Aragoneses 2016-01-28 10:20:51 UTC
> Andres, what does your fsproj look like?

What fsproj? Jason, take in account this bug is about creating a solution, not opening one. Because of this bug, no fsproj file is ever created.

> Do you have any other folders in C:\Program Files (x86)\Microsoft SDKs\F# ?

Nope, only folder inside the F# folder is C:\Program Files (x86)\Microsoft SDKs\F#\3.0\Framework\v4.0.
Comment 10 Matt Ward 2016-01-28 10:41:45 UTC
Had another brief look at this. I changed the new project dialog recently so it now tries to get the code dom from the language binding so it can verify the project name is valid for that language. That is currently failing on Windows with Xamarin Studio 6 preview 4 looking at the logs provided.

Looking at the F# addin it defines the code dom type for its language binding to be FSharp.Compiler.CodeDom.FSharpCleanCodeProvider. So presumably this type is found in the FSharp.Compiler.CodeDom.dll that ships with the F# addin. Looking at the FSharp.Compiler.CodeDom.dll assembly it references FSharp.Core, Version=4.3.1.0. The F# addin itself includes FSharp.Core, Version=4.3.0.0. So presumably this will only work if FSharp.Core 4.3.1 is available from another install of F# which adds that assembly to the GAC. If FSharp.Compiler.CodeDom referenced FSharp.Core 4.3.0 then I guess it would work.
Comment 11 Jason Imison 2016-01-29 15:39:24 UTC
I changed the default version of FSharp.Core https://github.com/fsharp/xamarin-monodevelop-fsharp-addin/pull/186/files to 4.3.1.0

Would it be possible for you to build from source and see if this works? The only way I know of to get just F# 3.0 installed is to create a new Windows install with just VS2012 installed. 
I renamed the F# 3.1 and 4.0 folders on my machine and it seemed to work ok - but I'm not sure what GAC versions were floating around.
Comment 12 Matt Ward 2016-02-04 10:41:32 UTC
*** Bug 38431 has been marked as a duplicate of this bug. ***
Comment 13 Matt Ward 2016-02-19 16:58:52 UTC
*** Bug 38924 has been marked as a duplicate of this bug. ***
Comment 14 Jason Imison 2016-02-22 09:40:37 UTC
FSharp.Core 4.4.0.0 is now bundled with the plugin https://github.com/fsharp/xamarin-monodevelop-fsharp-addin/commit/235e5eb269f0f0c565dd458d1b2c55aad16f2baa, and assembly binding redirects are in place in XS to make sure that this version is used.
Comment 15 Andres G. Aragoneses 2016-02-23 02:52:51 UTC
> FSharp.Core 4.4.0.0 is now bundled with the plugin

What version of XS did that land on? I ask because I'm testing XS6.0 build 4520 and it still fails.
Comment 16 Matt Ward 2016-02-23 09:20:51 UTC
The FSharp.Core fix landed after the first alpha.

I tested Xamarin Studio 6.0.0.4571 although the original binding redirects were added around version 4550.
Comment 17 Andres G. Aragoneses 2016-02-23 09:24:45 UTC
Ok, looking forward to the next version then.
Comment 18 Andres G. Aragoneses 2016-03-14 04:20:40 UTC
With XS6.0 build 4761 this bug doesn't happen anymore (I can create new F# projects now, yay!). However, they don't compile, so I've opened a new bug report: bug 39575.