SkiaSharp icon indicating copy to clipboard operation
SkiaSharp copied to clipboard

Reduce Runtime output footprint

Open DamianSuess opened this issue 1 year ago • 5 comments

Is your feature request related to a problem? Please describe.

Currently, all runtimes are being generated in the output folder - Linux (x86/x64/ARM/MUSL), OSX, Windows (x86/x64/Arm64), Win7 - which generates ~132 MB of space, when I only need Windows and Linux.

Describe the solution you'd like

As a user, I want to be able to select at compile time which runtimes are to be generated in the output folder. For instance, the required Windows x64 and Linux x64 files, reduce the output down to 21 MB.

Describe alternatives you've considered

Manually delete the files before packaging. This needs to be performed across all of our projects which reference SkiaSharp.

Additional context We are using, Avalonia.Skia.dll

DamianSuess avatar Jul 07 '23 13:07 DamianSuess

Specify <RuntimeIdentifiers> in your project file

https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#runtimeidentifiers

https://learn.microsoft.com/en-us/dotnet/core/rid-catalog

ojb500 avatar Jul 07 '23 17:07 ojb500

Thank you, @ojb500 for the quick reply and for providing reference resources.

Unfortunately, the project is still generating all of the runtimes regardless of the addition to the .csproj file. I tried even just specifying win10-x64 only and linux & mac runtimes are still being generated. I can keep toying around.. perhaps, i'm doing something incorrectly?

image

    <PropertyGroup>
      <!-- Reduce Build Resources -->
      <!-- Supported languages https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#satelliteresourcelanguages -->
      <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
      <!-- Supported runtimes (https://learn.microsoft.com/en-us/dotnet/core/rid-catalog) -->
      <RuntimeIdentifiers>win10-x64;linux-x64</RuntimeIdentifiers>
    </PropertyGroup>

DamianSuess avatar Jul 07 '23 20:07 DamianSuess

Hmm, I'm pretty sure this is all I needed to do in my project to solve the same problem 🤔

Did you clean the output folder before rebuilding? And what kind of project is this?

ojb500 avatar Jul 07 '23 20:07 ojb500

Oh yes, cleaned it via VS2022 and even manually removed obj and bin folders. This is a project that uses Avalonia v0.10.21.

UPDATE: What I found was, using the singular, <RuntimeIdentifier>linux-x64</RuntimeIdentifier> limits the output to just linux-x64, but the plural <RuntimeIdentifiers> generates the subfolder runtimes for all of them. Interesting stuff indeed.

DamianSuess avatar Jul 07 '23 20:07 DamianSuess

Any luck on fixing this? Having the same issue.

JohnCampionJr avatar Dec 03 '23 22:12 JohnCampionJr