-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from rnwood/rnwood-patch-1
- Loading branch information
Showing
7 changed files
with
81 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
Rnwood.Dataverse.Data.PowerShell.FrameworkSpecific/Commands/ModuleInitProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Management.Automation; | ||
using System.Management.Automation.Provider; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Rnwood.Dataverse.Data.PowerShell.FrameworkSpecific.Commands | ||
{ | ||
[CmdletProvider("Dataverse", ProviderCapabilities.None)] | ||
public class ModuleInitProvider : DriveCmdletProvider | ||
{ | ||
protected override Collection<PSDriveInfo> InitializeDefaultDrives() | ||
{ | ||
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; | ||
|
||
var assy = Assembly.Load(new AssemblyName("Microsoft.Xrm.Sdk")); | ||
WriteVerbose($"Loaded Dataverse SDK from {assy.Location}"); | ||
|
||
return base.InitializeDefaultDrives(); | ||
} | ||
|
||
private static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) | ||
{ | ||
string assyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); | ||
|
||
string assyName = args.Name.Split(',')[0]; | ||
string assyFile = assyDir + "/" + assyName + ".dll"; | ||
|
||
if (File.Exists(assyFile)) | ||
{ | ||
return Assembly.LoadFrom(assyFile); | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-3.02 KB
(47%)
Rnwood.Dataverse.Data.PowerShell/Rnwood.Dataverse.Data.PowerShell.psd1
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters