在Visual Studio代码中构建项目时,如何指定目标体系结构?

Dav*_*cco 6 f# f#-fake visual-studio-code ionide ml.net

我是VS code/F#的新手(如果这很傻,那就是preapologies),我正在尝试构建一个F#控制台应用程序(在Windows工作站和我的Linux计算机上).

我和FAKE一起安装了Ionide扩展.

我正在考虑的代码是Iris示例(请参阅如何将介绍ML.Net演示转换为F#?),使用Ionide创建一个新的F#项目并使用Microsoft.ML.

我的iris.fsproj

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net461</TargetFramework>
    <DebugType>portable</DebugType>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="iris.fs" />
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="..\.paket\Paket.Restore.targets" />
</Project>
Run Code Online (Sandbox Code Playgroud)

运行脚本时(我使用"播放"按钮,也就是F#:运行VS Code/Ionide提供的脚本),我得到:

C:\Users\MyUser\.nuget\packages\microsoft.ml\0.2.0\build\Microsoft.ML.targets(16,5): error : Microsoft.ML currently supports 'x64' processor architectures. Please ensure your application is targeting 'x64'.

和...一起

Running build failed. Error: System.Exception: dotnet build failed

如何使用Ionide提供的项目结构来定位x64?

rmu*_*unn 9

它应该像在您的PropertyGroup部分中添加以下行一样简单:

<PlatformTarget>x64</PlatformTarget>
Run Code Online (Sandbox Code Playgroud)

Condition根据编译器的各种命令行参数,使用该属性设置平台目标有更复杂的设置,但这应该是让您启动并运行的最简单方法.