Skip to content

Commit

Permalink
fix: Warn when net8.0 is placed first in TFMs
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Jul 12, 2024
1 parent c7b7501 commit bbcbd9d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions doc/articles/uno-build-error-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ This warning can be disabled by adding the following to your `.csproj`:
</PropertyGroup>
```

### UNOB00012: The net8.0 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` TargetFramework is placed first in the `TargetFrameworks` property.

Make sure that `net8.0` is not first in your `<TargetFrameworks>` property.

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

```xml
<PropertyGroup>
<UnoDisableVSWarnNetIsFirst>true</UnoDisableVSWarnNetIsFirst>
</PropertyGroup>
```

## Compiler Errors

### UNO0001
Expand Down
14 changes: 14 additions & 0 deletions src/Uno.Sdk/targets/Uno.Sdk.After.targets
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,20 @@
Text="The windows TargetFramework must not be placed first in the TargetFrameworks property in order for other platforms debugging to work. (See https://aka.platform.uno/UNOB0012)" />
</Target>

<Target Name="_UnoVSWarnNetIsFirst"
BeforeTargets="_SetBuildInnerTarget;_ComputeTargetFrameworkItems"
Condition="
'$(UnoDisableVSWarnNetIsFirst)' != 'true'
AND '$(BuildingInsideVisualStudio)' == 'true'
AND '$(_UnoTargetFrameworkCount)' != ''
AND $(_UnoTargetFrameworkCount) &gt; 1
AND $([MSBuild]::GetTargetPlatformIdentifier($(_UnoFirstOriginalTargetFramework))) == ''
AND $(_UnoFirstOriginalTargetFramework.StartsWith('net'))">

<Warning Code="UNOB0013"
Text="The $(_UnoFirstOriginalTargetFramework) TargetFramework must not be placed first in the TargetFrameworks property in order for other platforms debugging to work. (See https://aka.platform.uno/UNOB0013)" />
</Target>

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

Expand Down

0 comments on commit bbcbd9d

Please sign in to comment.