Install the FK 4.1 SDK on the build server

I installed Visual Studio 2017 with F # support on my PC and I have MSBuild targets in C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\FSharp and F # 4.1 SDK in C:\Program Files (x86)\Microsoft SDKs\F#\4.1

I installed Build Tools for Visual Studio 2017 (from https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15 ), but there is no way to install the F # SDK to build F projects # MSBuild 15 failed.

How to install the F # 4.1 SDK without installing Visual Studio?

+5
source share
3 answers

A short-term fix, until the SDK is installed separately, should add a directive to the project file to look in the NuGet package folder for the Microsoft.FSharp.Targets file. Here are the steps I took to fix this:

Make sure you are using the new F # project from VS.NET 2017 as it has this directive:

 <Import Project="..\packages\FSharp.Compiler.Tools.4.1.17\build\FSharp.Compiler.Tools.props" Condition="Exists('..\packages\FSharp.Compiler.Tools.4.1.17\build\FSharp.Compiler.Tools.props')" /> 

Replace this section of the project file:

 <Choose> <When Condition="$(TargetFSharpCoreVersion) &gt;= 4.3.0.0 AND $(TargetFSharpCoreVersion) &lt; 4.3.1.0 "> <PropertyGroup> <FSharpTargetsPath>$(MSBuildProgramFiles32)\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath> </PropertyGroup> </When> <When Condition="$(TargetFSharpCoreVersion) &gt;= 4.3.1.0 AND $(TargetFSharpCoreVersion) &lt; 4.4.0.0 "> <PropertyGroup> <FSharpTargetsPath>$(MSBuildProgramFiles32)\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath> </PropertyGroup> </When> <When Condition="$(TargetFSharpCoreVersion) &gt;= 4.4.0.0 AND $(TargetFSharpCoreVersion) &lt; 4.4.1.0 "> <PropertyGroup> <FSharpTargetsPath>$(MSBuildProgramFiles32)\Microsoft SDKs\F#\4.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath> </PropertyGroup> </When> <Otherwise> <PropertyGroup> <FSharpTargetsPath>$(MSBuildProgramFiles32)\Microsoft SDKs\F#\4.1\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath> </PropertyGroup> </Otherwise> </Choose> 

Using this XML:

  <Choose> <When Condition="$(TargetFSharpCoreVersion) &gt;= 4.3.0.0 AND $(TargetFSharpCoreVersion) &lt; 4.3.1.0 "> <PropertyGroup> <FSharpTargetsPath>$(MSBuildProgramFiles32)\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath> </PropertyGroup> </When> <When Condition="$(TargetFSharpCoreVersion) &gt;= 4.3.1.0 AND $(TargetFSharpCoreVersion) &lt; 4.4.0.0 "> <PropertyGroup> <FSharpTargetsPath>$(MSBuildProgramFiles32)\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath> </PropertyGroup> </When> <When Condition="$(TargetFSharpCoreVersion) &gt;= 4.4.0.0 AND $(TargetFSharpCoreVersion) &lt; 4.4.1.0 "> <PropertyGroup> <FSharpTargetsPath>$(MSBuildProgramFiles32)\Microsoft SDKs\F#\4.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath> </PropertyGroup> </When> <Otherwise> <PropertyGroup> <FSharpTargetsPath>$(MSBuildProgramFiles32)\Microsoft SDKs\F#\4.1\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath> </PropertyGroup> </Otherwise> </Choose> <!-- This is needed for TeamCity where F# SDK is only available via NuGet right now - hopefully can be removed at some point once the SDK is available for install --> <PropertyGroup Condition="!Exists('$(FSharpTargetsPath)')"> <FSharpTargetsPath>$(FscToolPath)\Microsoft.FSharp.Targets</FSharpTargetsPath> </PropertyGroup> 

Make sure you create a NuGet Service Pack server to restore before you build

Make sure the package contains the file: FSharp.Compiler.Tools and FSharp.Core

The reason for this is as follows: This checks if FSharpTargetsPath exists and if it does not use the package folder as the source. You do not want to always use the package folder, otherwise when a new scan is performed on the user's computer, packages are not available, and the assembly will fail. For this to work on the build server, it is assumed that you have a step to restore the NuGet PRIOR packages to complete the build.

+2
source

There is an MSI that can be installed; it has not yet been published on MSDN.
But it will be soon.

You can track this issue here: on GitHub:

"Deploying FSharp Tools MSI for MSDN # 2553" https://github.com/Microsoft/visualfsharp/issues/2553

Kevin Ransome

+4
source

It seems that new things have not yet been updated.

  • The four-step installation process for the build server (scroll down to option 3)

http://fsharp.org/use/windows/

(4.0)

  • According to the MSDN blog ...

https://blogs.msdn.microsoft.com/dotnet/2017/03/07/announcing-f-4-1-and-the-visual-f-tools-for-visual-studio-2017-2/

from blog post

It seems you need .NET Core / CLI

  • A search on Microsoft does not find anything ...

enter image description here

The closest thing is 4.0: https://www.microsoft.com/en-us/download/details.aspx?id=48179

  • There are still raw NuGet packages (4.1)

https://www.nuget.org/packages/FSharp.Compiler.Tools https://www.nuget.org/packages/FSharp.Core

  • Bottom line: I think that its so new it has not yet been released in a format similar to previous versions. I will check every 24 hours to see if they update them on their website.
+1
source

Source: https://habr.com/ru/post/1265197/


All Articles