From e6dfb67f3295152b284e33f39aa013099dfe5fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Laban?= Date: Wed, 29 Jan 2025 16:02:06 -0500 Subject: [PATCH] fix: Use newer project capability for WSL in VS 17.13 See https://developercommunity.visualstudio.com/t/WSL-launch-profile-cannot-be-found-when/10776961#T-N10813979 for more details. --- doc/articles/uno-build-error-codes.md | 4 ++-- src/Uno.Sdk/targets/Uno.Common.targets | 8 ++++++++ src/Uno.Sdk/targets/Uno.Sdk.After.targets | 5 +++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/articles/uno-build-error-codes.md b/doc/articles/uno-build-error-codes.md index 4aa58ec23bb7..84f3bd3138cf 100644 --- a/doc/articles/uno-build-error-codes.md +++ b/doc/articles/uno-build-error-codes.md @@ -131,7 +131,7 @@ See how to [make platforms conditional](xref:Uno.GettingStarted.CreateAnApp.Ride ### UNOB0015: The desktop TargetFramework must be placed first -In Visual Studio 17.12 or later, when both mobile (`-ios`, `-android`, `-maccatalyst`) and `desktop` target frameworks are used, the `-desktop` target framework must be placed first in order for WSL debugging to work. +In Visual Studio 17.13 or earlier, when both mobile (`-ios`, `-android`, `-maccatalyst`) and `desktop` target frameworks are used, the `-desktop` target framework must be placed first in order for WSL debugging to work. If `-desktop` is not first, the following message will appear: @@ -139,7 +139,7 @@ If `-desktop` is not first, the following message will appear: The project doesn't know how to run the profile with name 'MyApp (Desktop WSL2)' and command 'WSL2'. ``` -To fix the issue, reorder the items in your `.csproj` so that `TargetFrameworks` contains `netX.0-desktop` as the first target framework. +To fix the issue, reorder the items in your `.csproj` so that `TargetFrameworks` contains `netX.0-desktop` as the first target framework, or upgrade to Visual Studio 17.13 (when a stable release will be available). The Uno Platform team is following this [Visual Studio issue](https://developercommunity.visualstudio.com/t/WSL-launch-profile-cannot-be-found-when/10776961). diff --git a/src/Uno.Sdk/targets/Uno.Common.targets b/src/Uno.Sdk/targets/Uno.Common.targets index aa23807be1e4..e26e5ad0e53e 100644 --- a/src/Uno.Sdk/targets/Uno.Common.targets +++ b/src/Uno.Sdk/targets/Uno.Common.targets @@ -142,4 +142,12 @@ + + + + + diff --git a/src/Uno.Sdk/targets/Uno.Sdk.After.targets b/src/Uno.Sdk/targets/Uno.Sdk.After.targets index d6b38d0f7468..9608056a81ea 100644 --- a/src/Uno.Sdk/targets/Uno.Sdk.After.targets +++ b/src/Uno.Sdk/targets/Uno.Sdk.After.targets @@ -126,6 +126,7 @@ AND '$(BuildingInsideVisualStudio)' == 'true' AND '$(OutputType)'!='Library' AND $([MSBuild]::VersionGreaterThanOrEquals($(MSBuildVersion), 17.12.0)) + AND $([MSBuild]::VersionLessThan($(MSBuildVersion), 17.13.0)) AND '$(_UnoTargetFrameworkCount)' != '' AND $(_UnoTargetFrameworkCount) > 1 AND $(TargetFrameworks.Contains('-desktop')) @@ -136,8 +137,8 @@ ) AND $([MSBuild]::GetTargetPlatformIdentifier($(_UnoFirstOriginalTargetFramework))) != 'desktop'"> - +