Labs-Windows icon indicating copy to clipboard operation
Labs-Windows copied to clipboard

Generated solution should allow specific platforms

Open Arlodotexe opened this issue 2 years ago • 2 comments

Background

Using the GenerateAllSolution.ps1 script, we take a template of a solution file, dynamically add all sample projects to it, and spit out a working solution.

The problem

There are a few issues here that, if fixed, would improve the dev experience for our users.

  • The UseTargetFrameworks.ps1 file is not called as part of this script, meaning the user must manually enter the common/Scripts/ folder and execute it before generating the solution.
  • The script copies all platform heads from the template into the solution, even if the TargetFrameworks haven't been enabled and they wouldn't build.
  • When building the all-sample solution, some users may be in environments where not all heads can be built or deployed (missing tooling, on a specific OS, etc), or they might just not care about building a specific target framework.

The solution

To minimize the dependencies needed to build a platform head, we should adjust the script that generates the all-sample solution to also take a targets parameter, similar to the UseTargetFrameworks script:

Param (
    [Parameter(HelpMessage = "The target frameworks to enable.")]
    [ValidateSet('all', 'wasm', 'uwp', 'winappsdk', 'wpf', 'gtk', 'macos', 'ios', 'droid')]
    [string[]]$targets,
)

This should generate a solution with only the requested platforms and target frameworks present.

Arlodotexe avatar May 17 '22 15:05 Arlodotexe

It should be noted that the UseTargetFramework.ps1 script is not being called internally when generating a solution, at all. Features that depend on non-default target frameworks might not work.

Luckily, the build system is smart enough to pick netstandard2.0 as the next best candidate when building most platforms, which Uno does support. We just lose some platform-specific functionality until we fix this.

Arlodotexe avatar Jul 20 '22 02:07 Arlodotexe

#125 is now a prerequisite issue. Please make sure it's complete before starting on this.

Arlodotexe avatar Aug 10 '22 18:08 Arlodotexe