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

fix: Adjust VS build #316

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/Resizetizer/src/SkiaSharpTools.Initializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,31 @@ public static void Initialize()
{
SetupResolver();
}
else
{
SetupWindows();
}
}
}

/// <remarks>
/// Load libraries explicitly on Windows, as search paths may not be available when
/// running inside VS msbuild nodes.
/// </remarks>
private static void SetupWindows()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
foreach (var runtimePath in GetRuntimesFolder())
{
if (Directory.Exists(runtimePath))
{
foreach (var file in Directory.GetFiles(runtimePath, "*.dll"))
{
var r = LoadLibrary(file);
}
}
}
}
}

Expand Down Expand Up @@ -184,6 +209,10 @@ IntPtr localDlOpen(string fileName)
[DllImport("libSystem.dylib", EntryPoint = "dlopen")]
public static extern IntPtr dlopen_macos(string fileName, int flags);

// Declare dllimport for loadlibrary
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr LoadLibrary(string lpFileName);

// Imported from https://github.com/mono/SkiaSharp/blob/482e6ee2913a08a7cad76520ccf5fbce97c7c23b/binding/Binding.Shared/LibraryLoader.cs
private static class Linux
{
Expand Down
Loading