我正在尝试在Ubuntu 17.10(mono 4.6.2)上构建一个FSharp项目(控制台)但是我遇到了Fsharp核心.net问题。作为参考,我使用的是VsCode 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>
我使用此说明作为我的设置的参考: https://medium.com/@edgarsanchezg/four-easy-steps-for-installing-f-in-ubuntu-linux-88122323f12b
答案 0 :(得分:3)
项目文件指定了错误的TargetFramework
。将其更改为例如netcoreapp2.0
Target Framework Moniker应该修复构建。
答案 1 :(得分:1)
您尝试构建/恢复的项目正在引用自身。只需从fsproj
文件中删除此部分:
<ItemGroup>
<ProjectReference Include="fsTest.fsproj">
<Name>fsTest.fsproj</Name>
</ProjectReference>
</ItemGroup>