How do I specify a target architecture when building projects in Visual Studio code?
Asked Answered
J

1

5

I am new to VS code/F# and I am trying to build a F# console app (on both Windows workstation and on my Linux computer).

I installed the Ionide extension together with FAKE.

The code I am considering is the Iris example (see How to translate the intro ML.Net demo to F#?), creating a New F# Project with Ionide and using Microsoft.ML.

My iris.fsproj is

<?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>

When running the script (which I do with the "play" button aka F#: run script provided with VS Code/Ionide) I get:

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'.

together with

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

How do I target x64 with the project structure provided by Ionide?

Jeffryjeffy answered 21/6, 2018 at 8:26 Comment(0)
L
8

It should be as simple as adding the following line to your PropertyGroup section:

<PlatformTarget>x64</PlatformTarget>

There are more complicated setups possible using the Condition attribute to set the platform target based on various command-line arguments to the compiler, but that should be the simplest way to get you up and running.

Limy answered 21/6, 2018 at 8:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.