Linux 上的 F# 核心 .NET 框架构建方法
F# core .NET framework on Linux build how-to
我正在尝试在 Ubuntu 17.10 (Mono 4.6.2) 上构建一个 F# 项目(控制台),但是我 运行 遇到了 F# 核心 .NET 问题。作为参考,我使用 Visual Studio Code 1.21.2 和 ionide 扩展(新项目和 FAKE 构建)。下面是输出。
我尝试添加对 Fsharp.core 不同版本的明确引用,例如4.2、4.3.4 运气不好。
我应该看哪里才能解决这个问题?
Finished Target: InstallDotNetCLI
Starting Target: Restore (==> InstallDotNetCLI)
/home/lear/.local/share/dotnetcore/dotnet restore
Restoring packages for /home/lear/src/fsTest/fsTest/fsTest.fsproj...
/home/lear/src/fsTest/fsTest/fsTest.fsproj : error NU1100: Unable to resolve 'FSharp.Core (>= 4.3.4)' for '.NETFramework,Version=v4.6.1'.
Restore failed in 99.61 ms for /home/lear/src/fsTest/fsTest/fsTest.fsproj.
Running build failed.
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.3.4" />
</ItemGroup>
项目文件如下所示:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net461</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="fsTest.fsproj">
<Name>fsTest.fsproj</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="fsTest.fs" />
<None Include="App.config" />
</ItemGroup>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
我使用此说明作为我的设置参考:
Four easy steps for installing F# on Ubuntu Linux (2017-07-03)
项目文件指定错误TargetFramework
。将其更改为例如netcoreapp2.0
Target Framework Moniker 应该修复构建。
您尝试 build/restore 的项目正在引用自身。只需从 fsproj
文件中删除此部分:
<ItemGroup>
<ProjectReference Include="fsTest.fsproj">
<Name>fsTest.fsproj</Name>
</ProjectReference>
</ItemGroup>
我正在尝试在 Ubuntu 17.10 (Mono 4.6.2) 上构建一个 F# 项目(控制台),但是我 运行 遇到了 F# 核心 .NET 问题。作为参考,我使用 Visual Studio Code 1.21.2 和 ionide 扩展(新项目和 FAKE 构建)。下面是输出。
我尝试添加对 Fsharp.core 不同版本的明确引用,例如4.2、4.3.4 运气不好。
我应该看哪里才能解决这个问题?
Finished Target: InstallDotNetCLI
Starting Target: Restore (==> InstallDotNetCLI)
/home/lear/.local/share/dotnetcore/dotnet restore
Restoring packages for /home/lear/src/fsTest/fsTest/fsTest.fsproj...
/home/lear/src/fsTest/fsTest/fsTest.fsproj : error NU1100: Unable to resolve 'FSharp.Core (>= 4.3.4)' for '.NETFramework,Version=v4.6.1'.
Restore failed in 99.61 ms for /home/lear/src/fsTest/fsTest/fsTest.fsproj.
Running build failed.
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.3.4" />
</ItemGroup>
项目文件如下所示:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net461</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="fsTest.fsproj">
<Name>fsTest.fsproj</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="fsTest.fs" />
<None Include="App.config" />
</ItemGroup>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
我使用此说明作为我的设置参考: Four easy steps for installing F# on Ubuntu Linux (2017-07-03)
项目文件指定错误TargetFramework
。将其更改为例如netcoreapp2.0
Target Framework Moniker 应该修复构建。
您尝试 build/restore 的项目正在引用自身。只需从 fsproj
文件中删除此部分:
<ItemGroup>
<ProjectReference Include="fsTest.fsproj">
<Name>fsTest.fsproj</Name>
</ProjectReference>
</ItemGroup>