From 9b60e26ffafc50e8516fc56c4c55e7e706f82ff1 Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Thu, 4 Apr 2024 17:07:42 -0400 Subject: [PATCH] fix: Adjust target framework order for window --- doc/articles/uno-build-error-codes.md | 18 ++++++++++++++++-- src/Uno.Sdk/targets/Uno.Sdk.After.targets | 17 +++++++++++++++-- .../EntryPoint.ActiveProfileSync.cs | 10 +++++----- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/doc/articles/uno-build-error-codes.md b/doc/articles/uno-build-error-codes.md index f3970755cdf7..76618e45faea 100644 --- a/doc/articles/uno-build-error-codes.md +++ b/doc/articles/uno-build-error-codes.md @@ -69,7 +69,7 @@ Alternatively you may disable the Implicit Package References ### UNOB00010: The browserwasm TargetFramework must not be placed first in the TargetFrameworks property -In Visual Studio 2022, an issue prevents debugging and Hot Reload from working properly for all targets when the `net8.0-browserwasm` TargetFramework is placed first in the `TargetFrameworks` property. +In Visual Studio 2022, [an issue](https://aka.platform.uno/singleproject-vs-reload) prevents debugging and Hot Reload from working properly for all targets when the `net8.0-browserwasm` TargetFramework is placed first in the `TargetFrameworks` property. Make sure to place `net8.0-browserwasm` last in your `` property. @@ -83,7 +83,7 @@ This warning can be disabled by adding the following to your `.csproj`: ### UNOB00011: The desktop TargetFramework must not be placed first in the TargetFrameworks property -In Visual Studio 2022, an issue prevents other platforms debugging from working properly when the `net8.0-desktop` TargetFramework is placed first in the `TargetFrameworks` property. +In Visual Studio 2022, [an issue](https://aka.platform.uno/singleproject-vs-reload) prevents other platforms debugging from working properly when the `net8.0-desktop` TargetFramework is placed first in the `TargetFrameworks` property. Make sure that `net8.0-desktop` is not first in your `` property. @@ -95,6 +95,20 @@ This warning can be disabled by adding the following to your `.csproj`: ``` +### UNOB00012: The windows TargetFramework must not be placed first in the TargetFrameworks property + +In Visual Studio 2022, [an issue](https://aka.platform.uno/singleproject-vs-reload) prevents other platforms debugging from working properly when the `net8.0-windows10.xxx` TargetFramework is placed first in the `TargetFrameworks` property. + +Make sure that `net8.0-windows10.xxx` is not first in your `` property. + +This warning can be disabled by adding the following to your `.csproj`: + +```xml + + true + +``` + ## Compiler Errors ### UNO0001 diff --git a/src/Uno.Sdk/targets/Uno.Sdk.After.targets b/src/Uno.Sdk/targets/Uno.Sdk.After.targets index ce517f850c4b..6b6069f8d3d8 100644 --- a/src/Uno.Sdk/targets/Uno.Sdk.After.targets +++ b/src/Uno.Sdk/targets/Uno.Sdk.After.targets @@ -14,8 +14,8 @@ diff --git a/src/Uno.UI.RemoteControl.VS/EntryPoint.ActiveProfileSync.cs b/src/Uno.UI.RemoteControl.VS/EntryPoint.ActiveProfileSync.cs index 11e1761883da..94643ad3d399 100644 --- a/src/Uno.UI.RemoteControl.VS/EntryPoint.ActiveProfileSync.cs +++ b/src/Uno.UI.RemoteControl.VS/EntryPoint.ActiveProfileSync.cs @@ -103,7 +103,7 @@ bool IsCompatible(ILaunchProfile profile) } } - await TryReloadWebAssemblyOrDesktopTargetAsync(previousFramework, newFramework, targetFrameworkIdentifier); + await TryReloadTargetAsync(previousFramework, newFramework, targetFrameworkIdentifier); } } @@ -146,7 +146,7 @@ private async Task OnDebugProfileChangedAsync(string? previousProfile, string ne => targetFrameworks.FirstOrDefault(f => f.IndexOf("-" + identifier, StringComparison.OrdinalIgnoreCase) != -1); } - private async Task TryReloadWebAssemblyOrDesktopTargetAsync(string? previousFramework, string newFramework, string targetFrameworkIdentifier) + private async Task TryReloadTargetAsync(string? previousFramework, string newFramework, string targetFrameworkIdentifier) { if (_wasmProjectReloadTask is not null) { @@ -160,8 +160,8 @@ private async Task TryReloadWebAssemblyOrDesktopTargetAsync(string? previousFram if (previousFramework is not null && GetTargetFrameworkIdentifier(previousFramework) is { } previousTargetFrameworkIdentifier && ( - previousTargetFrameworkIdentifier is WasmTargetFrameworkIdentifier or DesktopTargetFrameworkIdentifier - || targetFrameworkIdentifier is WasmTargetFrameworkIdentifier or DesktopTargetFrameworkIdentifier) + previousTargetFrameworkIdentifier is WasmTargetFrameworkIdentifier or DesktopTargetFrameworkIdentifier or Windows10TargetFrameworkIdentifier + || targetFrameworkIdentifier is WasmTargetFrameworkIdentifier or DesktopTargetFrameworkIdentifier or Windows10TargetFrameworkIdentifier) && await _dte.GetStartupProjectsAsync() is { Length: > 0 } startupProjects ) { @@ -192,7 +192,7 @@ previousTargetFrameworkIdentifier is WasmTargetFrameworkIdentifier or DesktopTar return; } - _warningAction?.Invoke($"Detected that the active framework was changed from/to WebAssembly/Desktop, reloading the project (See https://aka.platform.uno/singleproject-vs-reload)"); + _warningAction?.Invoke($"Detected that the active framework was changed from/to WebAssembly/Desktop/Windows, reloading the project (See https://aka.platform.uno/singleproject-vs-reload)"); // In this context, in order to work around the fact that VS does not handle Wasm // to be in the same project as other target framework, we're using the `_SelectedTargetFramework`