Skip to content

Commit

Permalink
fix: Warn if desktop tf is not first for WSL debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban authored Apr 1, 2024
1 parent 7acdc5d commit dbde71e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
28 changes: 28 additions & 0 deletions doc/articles/uno-build-error-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,34 @@ Alternatively you may disable the Implicit Package References
</PropertyGroup>
```

### 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.

Make sure to place `net8.0-browserwasm` last in your `<TargetFrameworks>` property.

This warning can be disabled by adding the following to your `.csproj`:

```xml
<PropertyGroup>
<UnoDisableVSWarnBrowserNotFirst>true</UnoDisableVSWarnBrowserNotFirst>
</PropertyGroup>
```

### UNOB00011: The desktop TargetFramework must be placed first in the TargetFrameworks property

In Visual Studio 2022, an issue prevents debugging WSL debugging from working properly when the `net8.0-desktop` TargetFramework is not placed first in the `TargetFrameworks` property.

Make sure to place `net8.0-desktop` first in your `<TargetFrameworks>` property.

This warning can be disabled by adding the following to your `.csproj`:

```xml
<PropertyGroup>
<UnoDisableVSWarnDesktopNotFirst>true</UnoDisableVSWarnDesktopNotFirst>
</PropertyGroup>
```

## Compiler Errors

### UNO0001
Expand Down
13 changes: 13 additions & 0 deletions src/Uno.Sdk/targets/Uno.Sdk.After.targets
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@
Text="The browserwasm TargetFramework must not be placed first in the TargetFrameworks property in order for HotReload to work properly. (See https://aka.platform.uno/UNOB0010)" />
</Target>

<Target Name="_UnoVSWarnDesktopNotFirst"
BeforeTargets="_SetBuildInnerTarget;_ComputeTargetFrameworkItems"
Condition="
'$(UnoDisableVSWarnDesktopNotFirst)' != 'true'
AND '$(BuildingInsideVisualStudio)' == 'true'
AND $(ActiveDebugProfile.Contains('WSL'))
AND $([MSBuild]::GetTargetPlatformIdentifier($(ActiveDebugFramework))) == 'desktop'
AND $([MSBuild]::GetTargetPlatformIdentifier($(_UnoFirstOriginalTargetFramework))) != 'desktop'">

<Warning Code="UNOB0011"
Text="The desktop TargetFramework must be placed first in the TargetFrameworks property in order for WSL debugging to work properly. (See https://aka.platform.uno/UNOB0011)" />
</Target>

<!-- Include any additional targets that packages defined by other packages -->
<Import Project="$(AfterUnoSdkTargets)" Condition="'$(AfterUnoSdkTargets)' != ''"/>

Expand Down

0 comments on commit dbde71e

Please sign in to comment.