Skip to content

Project should be able to declare supported platforms/TFMs #298

@Arlodotexe

Description

@Arlodotexe

Describe the bug

Projects created with the current project template are hardcoded to use TargetFrameworks.props, which globally affects all files.

We need a way to specify the TargetFrameworks for a project from the project itself, rather than from the global TargetFrameworks.props file.

This may be doable by making the TargetFrameworks conditional.

<!-- Example only -->
<PropertyGroup Condition="$(IsWasm) = 'true'">
  <TargetFrameworks>$(TargetFrameworks);$(WasmTargetFramework)</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="$(IsUwp) = 'true'">
  <TargetFrameworks>$(TargetFrameworks);$(UwpTargetFramework)</TargetFrameworks>
</PropertyGroup>

(...etc)

A developer can use these variable as flags at the top of the csproj for their Sample/Library project.

Sidenote: It's not clear if this is fully supported in MSBuild/Visual Studio.

To handle this in the "All projects" solution, we need to modify the DiscoverSamples.ps1 script to check discovered projects for the existing IsWasm, IsUwp, etc., properties to determine if it should be referenced by the sample head. Experiment projects do not use these properties yet, so they'll need to be added as needed.

Steps to reproduce

n/a

Expected behavior

Project should be able to declare supported platforms/TFMs

Screenshots

No response

Code Platform

  • UWP
  • WinAppSDK / WinUI 3
  • Web Assembly (WASM)
  • Android
  • iOS
  • MacOS
  • Linux / GTK

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

No response

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

No response

Visual Studio Build Number

No response

Device form factor

No response

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item.

Metadata

Metadata

Assignees

Labels

dev loop ➰For issues that impact the core dev-loop of building experimentsenhancementImprovement to an existing feature

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions