Skip to content

Commit

Permalink
Merge pull request #1555 from glopesdev/issue-1549
Browse files Browse the repository at this point in the history
Add library folders to DLL search path on windows
  • Loading branch information
glopesdev authored Sep 13, 2023
2 parents 39f60ec + e3e39f9 commit 97b20bd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Bonsai.Configuration/Bonsai.Configuration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<VersionPrefix>2.8.0</VersionPrefix>
<VersionPrefix>2.8.1</VersionPrefix>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Bonsai.NuGet\Bonsai.NuGet.csproj" />
Expand Down
5 changes: 5 additions & 0 deletions Bonsai.Configuration/ConfigurationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ static void AddLibraryPath(string path)
currentPath = string.Join(new string(Path.PathSeparator, 1), path, currentPath);
Environment.SetEnvironmentVariable(PathEnvironmentVariable, currentPath);
}

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
NativeMethods.AddDllDirectory(path);
}
}

public static string GetConfigurationRoot(PackageConfiguration configuration = null)
Expand Down
11 changes: 11 additions & 0 deletions Bonsai.Configuration/NativeMethods.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using System.Runtime.InteropServices;

namespace Bonsai.Configuration
{
static class NativeMethods
{
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
internal static extern int AddDllDirectory(string NewDirectory);
}
}
2 changes: 1 addition & 1 deletion Bonsai.Player/Bonsai.Player.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageLicenseUrl></PackageLicenseUrl>
<PackageIcon>icon.png</PackageIcon>
<PackageIconUrl></PackageIconUrl>
<VersionPrefix>2.8.0</VersionPrefix>
<VersionPrefix>2.8.1</VersionPrefix>
<PackAsTool>true</PackAsTool>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Bonsai/Bonsai.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<UseWindowsForms>true</UseWindowsForms>
<TargetFramework>net48</TargetFramework>
<VersionPrefix>2.8.0</VersionPrefix>
<VersionPrefix>2.8.1</VersionPrefix>
<OutputType>Exe</OutputType>
<DisableWinExeOutputInference>true</DisableWinExeOutputInference>
<ApplicationIcon>..\Bonsai.Editor\Bonsai.ico</ApplicationIcon>
Expand Down

0 comments on commit 97b20bd

Please sign in to comment.