Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Windows Nano Server #676

Closed
mattleibow opened this issue Nov 6, 2018 · 13 comments
Closed

Support Windows Nano Server #676

mattleibow opened this issue Nov 6, 2018 · 13 comments

Comments

@mattleibow
Copy link
Contributor

mattleibow commented Nov 6, 2018

Description

Windows Nano Server is missing some dlls, so SkiaSharp does not work. Related to #591

Having a look at Nano Server... Ran the NanoServerApiScan.exe tool from: https://blogs.technet.microsoft.com/nanoserver/2016/04/27/nanoserverapiscan-exe-updated-for-tp5/

=== libSkiaSharp.dll ===

ERRORS:

  FONTSUB.dll
    CreateFontPackage(Proc not found)
  USER32.dll
    SystemParametersInfoW(Proc not found)
  MSVCP140.dll
    …
    …
    …
      Please copy Nano Server compliant MSVCP140.dll from %ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\redist\onecore\x64\Microsoft.VC140.CRT\
  VCRUNTIME140.dll
    …
    …
    …
      Please copy Nano Server compliant VCRUNTIME140.dll from %ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\redist\onecore\x64\Microsoft.VC140.CRT\

I need to investigate the 2 usages that appear to be bad:

  • FONTSUB.dll (CreateFontPackage)
  • USER32.dll (SystemParametersInfoW)

Just did some investigation :)

CreateFontPackage from FONTSUB.dll is just for XPS support - and this is also just for font subsetting. The UWP build does not have this at all, so I could just remove it for a nano build.

SystemParametersInfoW from USER32.dll is also not too essential - it is just for determining the default font. Again, this is not available for UWP - we just pick the "Segoe UI" which we know is available by default.

Nano Server support could very well be possible in the near future - just have to check priorities.

Add your vote to this issue so we can prioritize this issue.

VS bug #727251

@Starkie
Copy link

Starkie commented Mar 27, 2019

We just ran into this issue while trying to deploy an ASP.Net Core microservice dependent on SkiaSharp with the microsoft/dotnet:2.2-aspnetcore-runtime image.

Are there any news regarding this? 😢

@VictorIranzo
Copy link

@mattleibow Are there any news or other issues to follow related with this?

@AlexNosk
Copy link

@mattleibow We encountered the same problem when deploying Azure Functions. Are there any news about this?

@vijayasurya20
Copy link

Hi Team,

Are there any news regarding this?

Regards,
Vijayasurya A

@Gillibald
Copy link
Contributor

Sounds like we just need a new target externals-nano-server and leave out the parts that depend on not supported api. So in the end this is mostly how the UWP build works.

@mattleibow
Copy link
Contributor Author

mattleibow commented Nov 16, 2019

We just need to figure out how we would actually package this. Right now the Win32 is in the main NuGet. We might need to see how devs would use this. Will they use VS on Windows and do testing, and then deploy to Nano? If so, we need to find a way to have dotnet publish (and similar) to actually use the Nano binaries. That will probably be the hardest part - how do we distinguish between desktop vs nano Win32? NuGet has RIDs, but this is just win-xxx versions. Unless there is a more specific one for Nano?

I feel like I opened an issue for this already... somewhere...

Found it: NuGet/Home#7375 Seems they closed it and want me to do the work. Not going to happen 😉 They must step up to make the NuGet feature actually not just a patch-job for UWP.

@mattleibow
Copy link
Contributor Author

Just wrapped the NanoServerApiScan tool in a nice .NET Core tool: https://github.com/mattleibow/nano-api-scan

nano-api-scan path/to/libSkiaSharp.dll

After switching to static builds and Clang, we now only have a single method that we have to worry about:

=== libSkiaSharp.dll ===

ERRORS:

  FONTSUB.dll
    CreateFontPackage(Proc not found)

mattleibow added a commit that referenced this issue Nov 17, 2019
@mattleibow
Copy link
Contributor Author

mattleibow commented Nov 17, 2019

Good news! I think we can get Nano Server in for the next release I am planning next week if this build goes well: b265b43

Pretty much, I can exclude the usage in the comment above and no one woulds care - that is just for the experimental XPS document type subsetter. I have no numbers, but I don't think anyone would use that as we have better PDF support. Who uses XPS anyway? Hoping that the logic that I have for the "no dependencies" build of linux can be reused to created a "nano server" build.

From what I can see so far, we could get this working. Not going to be the prettiest at the moment because of the way the PackageReference and things work - and the open issue on NuGet (NuGet/Home#7375) makes is messy.

But, the usage looks to be:

<PackageReference Include="SkiaSharp" ExcludeAssets="native" />
<PackageReference Include="SkiaSharp.NativeAssets.NanoServer" />

This is basically saying work as normal, but instead of using the native runtime bits from "SkiaSharp", ignore it and use the "SkiaSharp.NativeAssets.NanoServer" instead. This only has to be done on the top-level app as the runtimes are only used on dotnet run and dotnet publish.

Not sure if this will work nicely, need to do a bit of testing. Fingers crossed.

mattleibow added a commit that referenced this issue Nov 17, 2019
@mattleibow
Copy link
Contributor Author

Heh, I think I was getting ahead of myself... next week is like Wednesday and there is no way a reasonable person should go stable with just a weekend hack :) Moved it out to a new PR #1014 that I will merge after I release. I want to try and get a more frequent release cadence with SkiaSharp - and give people more time to actually test Nano Server.

@mattleibow
Copy link
Contributor Author

mattleibow commented Nov 17, 2019

@mattleibow
Copy link
Contributor Author

I think I am almost ready to get this in with #1040 So far, Nano Server seems to be working

@mattleibow
Copy link
Contributor Author

Merged into master! Will push out some packages to the early-access feed as soon as CI is done. Also hope to go public preview soon as well.

@mattleibow
Copy link
Contributor Author

Just linking this new issue : NuGet/Home#8894

@mattleibow mattleibow added this to the v1.68.1.1 milestone Dec 19, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Aug 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.