【问题标题】:One F# 4.1 compiler includes targetPlatform value of netstandard, the other does not一个 F# 4.1 编译器包含 netstandard 的 targetPlatform 值,另一个不包含
【发布时间】:2017-09-29 00:26:35
【问题描述】:

我的构建机器上的 F# 4.1 编译器与我的开发机器上的 F# 4.1 编译器的 --targetProfile 选项略有不同。

在我的开发机器上,当我输入 fsc.exe -? 时,输出包括以下内容:

Microsoft (R) F# Compiler version 4.1
     :
--targetprofile:<string>
Specify target framework profile of this assembly.
Valid values are mscorlib, netcore or netstandard.
     :

在我的构建服务器上,相同的命令输出以下内容:

Microsoft (R) F# Compiler version 4.1
     :
--targetprofile:<string>
Specify target framework profile of this assembly.
Valid values are mscorlib or netcore.
     :

请注意,开发机器包含 netstandard 作为有效值,但构建服务器没有。

因此,当我尝试在构建服务器上构建我的项目时,我收到“error FS1052: Invalid value 'netstandard' for '--targetprofile'”的编译时错误

发生了什么事?有没有办法显示 F# 4.1 编译器的 real 版本号? fsc.exe --version 不起作用。

【问题讨论】:

    标签: f#


    【解决方案1】:

    我认为这与 F# 编译器版本无关,而是与安装的 .NET SDK 有关。 检查the target framework TFMs

    我有mscorlib, netcore or netstandard,我会试探一下它们的来源:

    • mscorlib 来自完整框架...Windows 自带
    • netcore 选择“.NET 桌面开发”时随 VS 2017 安装
    • netstandard 与 NET Core SDK 一起安装

    如果是这种情况,我会想象在构建服务器上安装 .NET Core SDK 会解决它,因为您似乎针对的是 netstandard。

    【讨论】:

    • TFS 管理员向我发送了一个屏幕截图,显示已安装 .NET Core 2.0 SDK。尽管如此,F# 编译器仍然说,“有效值是 mscorlib 或 netcore”。非常令人沮丧。
    • 项目中有global.json吗?
    • 该项目是一个 F# 类库项目。没有 global.json。但是,fsc.exe -?独立于项目运行。
    • 您是在本地机器上使用 fsc 构建它吗?还是用VS?哪个VS版本?如果为 netstandard 构建,我使用 dotnet build 在这种情况下,它将使用通过 dotnet --version 找到的路径上的 sdk,除非在树上某处指定特定 sdk 版本的 global.json
    • 当我在开发和构建服务器上构建我的项目时,我使用dotnet build。但是,fsc.exe -?独立于项目运行。
    猜你喜欢
    • 2021-09-21
    • 1970-01-01
    • 2022-11-10
    • 1970-01-01
    • 2016-04-27
    • 2021-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多