Skip to content

Existing F# projects won't open if only VS2015 is installed #4

Closed
@KevinRansom

Description

@KevinRansom

Opened on codeplex by ovastus:
Existing F# projects won't open if only VS2015 is installed

These 2 conditions present on most projects will fail if only VS2015 is installed:

<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">`
     <FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
     </PropertyGroup>
     <PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets')">
     <FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>

The workaround is simple, install the F# 3.1 bundle, but for a new user trying the language for the first time this can be a blocker. This sort of thing never happens in C#, but whenever there is a new F# version we always bump into these kinds of problems :(
Could the installer maybe bundle F# 3.0 and 3.1 together with 4.0?

comments
latkin wrote Jan 5 at 9:06 AM [x]

Those conditions are not present in the standard project templates included in VS. Where are you >getting that config from?

The standard project imports the targets file like so:

<Choose>
    <When Condition="'$(VisualStudioVersion)' == '11.0'">
      <PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
        <FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
      </PropertyGroup>
    </When>
    <Otherwise>
      <PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
        <FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
      </PropertyGroup>
    </Otherwise>
  </Choose>
  <Import Project="$(FSharpTargetsPath)" />

There is a backcompat check for 3.0 that points directly at the targets file, but everything since then (3.1+) has been picked up by a shim file that's dropped to C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v%VSVERSION%\FSharp. It's this file that actually points to the real targets file. You automatically get the latest targets file when you open in the latest VS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions