Sunday 15 March 2015

c# - How to handle dependencies for custom Powershell Cmdlets -


I am developing some PowerShell CMDlet which relies on third party libraries from Google, on my machine I have a CMDlet on one. I am able to compile the DL file and everything works, but when I try to load it on another machine, I can not get the assembly after running an import-module on my DLL file.

How can I package my CMDlets into a DLL file so that dependence on another machine is established, then leave my DLL file somewhere, load it and do it?

You will need to redistribute the third party library assemblies on which you depend. If you deploy ExCopy to your module, then you should be able to put those assemblies in the same directory as your CMDlet assembly. When you do an import-module on your module, those assemblies should load automatically with your assembly. You should consider creating a PSD1 file for your module.

No comments:

Post a Comment