Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
KevinRansom opened this issue Jan 14, 2015 · 8 comments
Closed

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

KevinRansom opened this issue Jan 14, 2015 · 8 comments

Comments

@KevinRansom
Copy link
Member

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.

@latkin
Copy link
Contributor

latkin commented Jan 16, 2015

Per my codeplex comment, would be interested to know if anyone else has encounted this behavior, or has project files that resemble the original from @ovatsus

@ovatsus
Copy link

ovatsus commented Jan 16, 2015

I got this on FSharp.Data project. I think the .fsprojs were manually modified because for a while mono didn't support , I forgot about that when I posted this issue on codeplex.

Will a fsproj from VS2012 that didn't have thise , open correctly on VS2015, both directly or after first upgrader to VS2013?

@jaredpar
Copy link
Member

This is the trick that I use to get my F# projects to open in any version of Visual Studio including 2015:

  <Choose>
    <When Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' == '9.0'">
      <PropertyGroup>
        <FSharpTargetsPath>$(ProgramFiles)\Microsoft F#\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
      </PropertyGroup>
    </When>
    <When Condition="'$(VisualStudioVersion)' == '11.0' or '$(VisualStudioVersion)' == '10.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)" />

Source: https://github.com/jaredpar/VsVim/blob/fixes-dev14/Src/VimCore/VimCore.fsproj#L38

@latkin
Copy link
Contributor

latkin commented Jan 16, 2015

Nice @jaredpar, looks close to the current default, but with 10.0 and 9.0 support. (9.0? F# wasn't even in VS in 9.0...)

@tpetricek
Copy link
Contributor

Yeah... most F# projects on GitHub that had early Travis CI support don't use <Choose> because that used to fail on Mono (see for example this). If this is now supported in Mono, we should probably fix all projects to use the standard format.

@jaredpar
Copy link
Member

Not sure why the 9.0 support is there. Wonder if that was from the pre-RTM
days before the version number flipped. This file dates back that far so
it's possible.

On Thursday, January 15, 2015, Lincoln Atkinson [email protected]
wrote:

Nice @jaredpar https://github.com/jaredpar, looks close to the current
default, but with 10.0 and 9.0 support. (9.0? F# wasn't even in VS in
9.0...)


Reply to this email directly or view it on GitHub
#4 (comment)
.

Jared Parsons
http://blog.paranoidcoding.com/
http://twitter.com/jaredpar

@latkin
Copy link
Contributor

latkin commented Jan 16, 2015

@ovatsus not exactly a full back-compat test pass, but I just created a default VS 2012 project, and it opened fine in VS 2015 straight away. The upgrade adds the version-agnostic stuff mentioned above. The project system code that detects and converts "11.0-era" projects to current style is still in place.

@PatrickMcDonald
Copy link
Contributor

From memory, didn't F# 1.0 install into Visual Studio 2008? It just wasn't installed _with_ VS until 2010

ForNeVeR added a commit to ForNeVeR/Umov.Csxcad that referenced this issue Jul 11, 2016
KevinRansom pushed a commit that referenced this issue Aug 20, 2016
liboz pushed a commit to liboz/visualfsharp that referenced this issue Oct 13, 2016
Seq.truncate (and fixing a typo)
cartermp added a commit to cartermp/fsharp that referenced this issue Jan 7, 2020
# This is the 1st commit message:

ref -> mutable in more places in the compiler

# The commit message dotnet#2 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20191229.1
#
# - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19629.1

# The commit message dotnet#3 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20191230.1
#
# - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19630.1

# The commit message dotnet#4 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20191231.1
#
# - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19631.1

# The commit message dotnet#5 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20200101.1
#
# - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20051.1

# The commit message dotnet#6 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20191216.5 (dotnet#8079)
#
# - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19616.5

# The commit message dotnet#7 will be skipped:

# dispose fsi at the end of a scripting session (dotnet#8084)
#

# The commit message dotnet#8 will be skipped:

# Added static link tests and extended CompilerAssert (dotnet#8101)
#
# * Changed CompilerAssert to static class. Added Compile/Execute methods that take a Compilation description. Added static link tests
# 
# * Hiding compilation description internals
# 
# * Added another test to check for sanity
# 
# * Making a few optional parameters
# 
# * Hiding internals of CompilationReference

# The commit message dotnet#9 will be skipped:

# Parameterize product version (dotnet#8031)
#
# * Parameterize Product details
# 
# * fcs
# 
# * Repack pkgdef
cartermp added a commit that referenced this issue Jan 7, 2020
…8063)

* # This is a combination of 9 commits.
# This is the 1st commit message:

ref -> mutable in more places in the compiler

# The commit message #2 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20191229.1
#
# - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19629.1

# The commit message #3 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20191230.1
#
# - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19630.1

# The commit message #4 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20191231.1
#
# - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19631.1

# The commit message #5 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20200101.1
#
# - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20051.1

# The commit message #6 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20191216.5 (#8079)
#
# - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19616.5

# The commit message #7 will be skipped:

# dispose fsi at the end of a scripting session (#8084)
#

# The commit message #8 will be skipped:

# Added static link tests and extended CompilerAssert (#8101)
#
# * Changed CompilerAssert to static class. Added Compile/Execute methods that take a Compilation description. Added static link tests
# 
# * Hiding compilation description internals
# 
# * Added another test to check for sanity
# 
# * Making a few optional parameters
# 
# * Hiding internals of CompilationReference

# The commit message #9 will be skipped:

# Parameterize product version (#8031)
#
# * Parameterize Product details
# 
# * fcs
# 
# * Repack pkgdef

* no ilread
DedSec256 added a commit to DedSec256/fsharp that referenced this issue Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants