Skip to content

Dotnet: Multi-target projects require all 'TargetFrameworks' installed in order to build #34496

@projectgoav

Description

@projectgoav

It was suggested I raise my query here via: dotnet/macios#18634

Describe the bug

I have the following csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>net6.0;net6.0-ios</TargetFrameworks>
  </PropertyGroup>

</Project>

When I execute the following command on Windows, Mac or Linux:

dotnet build <csproj> --framework net6.0

the build errors due to missing iOS workload.

On windows & Mac, this is easily solved by installing the ios workload.

On Linux, it recommends I install the macos workload. Doing so then results in:

error NETSDK1178: The project depends on the following workload packs that do not exist in any of the workloads available in this installation: Microsoft.iOS.Sdk.net6
error NETSDK1178: You may need to build the project on another operating system or architecture, or update the .NET SDK.

Why it this? I had assumed a multi-target project would only need the iOS workload installed when you specifcy --framework net6.0-ios?

Further technical details

  • Include the output of dotnet --info
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version

Happens on both dotnet v6 & v7 running on Windows, Mac-x64 & Linux-x64 machines either via the command line or via Visual Studio 19, Visual Studio 22 (Windows & Mac)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions