mono / SkiaSharp

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
MIT License
4.39k stars 535 forks source link

[BUG] Problems building SkiaSharp 2.88.4 using dotnet build #2579

Open TommiGustafsson-HMP opened 1 year ago

TommiGustafsson-HMP commented 1 year ago

Description

Using Visual Studio Community 17.7.2 and Developer PowerShell.

After installing all required workloads to build SkiaSharp 2.88.4, including Tizen (using Visual Studio Tools for Tizen), I get the following error using dotnet build:

PS C:\repos\mono\SkiaSharp\source> dotnet build
MSBuild version 17.8.0-preview-23367-03+0ff2a83e9 for .NET
  Determining projects to restore...
C:\Program Files\dotnet\sdk\8.0.100-preview.7.23376.3\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(117,5): error NETSDK1139:
The target platform identifier tizen was not recognized. [C:\repos\mono\SkiaSharp\binding\SkiaSharp.NativeAssets.Tizen\SkiaSharp.NativeAssets.Tizen.csproj::Ta
rgetFramework=net7.0-tizen]
C:\Program Files\dotnet\sdk\8.0.100-preview.7.23376.3\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(117,5): error NETSDK1139:
The target platform identifier tizen was not recognized. [C:\repos\mono\SkiaSharp\binding\HarfBuzzSharp.NativeAssets.Tizen\HarfBuzzSharp.NativeAssets.Tizen.cs
proj::TargetFramework=net7.0-tizen]

Build FAILED.

C:\Program Files\dotnet\sdk\8.0.100-preview.7.23376.3\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(117,5): error NETSDK1139:
The target platform identifier tizen was not recognized. [C:\repos\mono\SkiaSharp\binding\SkiaSharp.NativeAssets.Tizen\SkiaSharp.NativeAssets.Tizen.csproj::Ta
rgetFramework=net7.0-tizen]
C:\Program Files\dotnet\sdk\8.0.100-preview.7.23376.3\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(117,5): error NETSDK1139:
The target platform identifier tizen was not recognized. [C:\repos\mono\SkiaSharp\binding\HarfBuzzSharp.NativeAssets.Tizen\HarfBuzzSharp.NativeAssets.Tizen.cs
proj::TargetFramework=net7.0-tizen]
    0 Warning(s)
    2 Error(s)

Time Elapsed 00:00:14.05

If I try to install tizen with dotnet, I get:

PS C:\repos\mono\SkiaSharp\source> dotnet workload install tizen
Workload ID tizen is not recognized.

dotnet workload list gives:

PS C:\repos\mono\SkiaSharp\source> dotnet workload list

Installed Workload Id      Manifest Version                            Installation Source
---------------------------------------------------------------------------------------------------------------
android                    34.0.0-rc.1.429/8.0.100-preview.7           SDK 8.0.100-preview.7, VS 17.7.34018.315
maui                       8.0.0-preview.7.8922/8.0.100-preview.7      SDK 8.0.100-preview.7
tvos                       16.4.8694-net8-p7/8.0.100-preview.7         SDK 8.0.100-preview.7
maui-windows               8.0.0-preview.7.8922/8.0.100-preview.7      VS 17.7.34018.315
maui-maccatalyst           8.0.0-preview.7.8922/8.0.100-preview.7      VS 17.7.34018.315
maccatalyst                16.4.8694-net8-p7/8.0.100-preview.7         VS 17.7.34018.315
maui-ios                   8.0.0-preview.7.8922/8.0.100-preview.7      VS 17.7.34018.315
ios                        16.4.8694-net8-p7/8.0.100-preview.7         VS 17.7.34018.315
maui-android               8.0.0-preview.7.8922/8.0.100-preview.7      VS 17.7.34018.315

Use `dotnet workload search` to find additional workloads to install.

Updates are available for the following workload(s): maui tvos. Run `dotnet workload update` to get the latest.

There's no tizen to be found there. Then, I try dotnet workload restore, and it says:

PS C:\repos\mono\SkiaSharp\source> dotnet workload restore
Installing workloads:

Removing Microsoft.Android.Ref.31.Msi.x64 ............ Failed
Warning: Workload garbage collection failed with error: Failed to remove Microsoft.Android.Ref.31.32.0.476-x64.msi. Error: 0x00000643. Fatal error during installation..

Successfully installed workload(s) android maui tvos.

What might be the problem? Is there something I can do to build SkiaSharp?

Code

No code, see description.

Expected Behavior

SkiaSharp will build.

Actual Behavior

SkiaSharp will not build.

Version of SkiaSharp

Other (Please indicate in the description)

Last Known Good Version of SkiaSharp

Other (Please indicate in the description)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

All

Platform / Operating System Version

Using Windows 11 for building.

Devices

No response

Relevant Screenshots

No response

Relevant Log Output

No response

Code of Conduct

mattleibow commented 1 year ago

This does mean that for some reason tizen was not installed correctly. I usually use the script installer.

But, you can skip it for now by passing /pIsNetTizenSupported:false on the build.

TommiGustafsson-HMP commented 1 year ago

Thanks. I somehow managed to get the tizen workload installed and dotnet build is working. However, when I try to open the solution in Visual Studio, it cannot load projects but says:

C:\repos\mono\SkiaSharp\source\SkiaSharp.Views\SkiaSharp.Views\SkiaSharp.Views.csproj : error  : The expression "[MSBuild]::NormalizePath( Condition="'' == ''"C:\sdk-manifests\, microsoft.net.sdk.macos\WorkloadManifest.json)" cannot be evaluated. Illegal characters in path.  C:\repos\mono\SkiaSharp\source\SkiaSharp.Build.props

Any idea about this one?