Import PowerShell cmdlets module based on SDK assembly's location

Fixes #45
This commit is contained in:
Pat Hartl 2023-12-13 23:38:13 -06:00
parent 26f0ac22fb
commit 0bf4e8cc6d

View file

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
@ -33,7 +34,7 @@ namespace LANCommander.SDK.PowerShell
AddArgument("ExecutionPolicy", "Unrestricted");
var moduleManifests = Directory.EnumerateFiles(Environment.CurrentDirectory, "LANCommander.PowerShell.psd1", SearchOption.AllDirectories);
var moduleManifests = Directory.EnumerateFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "LANCommander.PowerShell.psd1", SearchOption.AllDirectories);
if (moduleManifests.Any())
AddModule(moduleManifests.First());