0
votes

I am converting a powershell snapin(which was working really fine) to a powershell module.

I have added the output dll to a folder with the same name as the dll and added the Module path to the $env:PSModulePath

The import seems to fail because the Snapin had some references to some other dll's(located in the bin\ folder)

I also don't want to copy all referenced dll's into the modules folder because they are already in the bin folder.

Is there a way to indicate the folder in which the referenced dll's are located in powershell? Maybe to indicate the folder like it is done for individual dll's:

[reflection.assembly]::loadfrom(full name of referenced dll)

1
May I ask why you don't want to copy the referenced dlls to the module's folder? I believe that is a fairly standard practice.blachniet
@blachniet: The reason is because I already have the dll's compiled into the *bin* folder. I only want to reference them from the modules folder. Consider the case when I have 20 modules and then I will have all the dll's copied in each module separately...Pinte Dani

1 Answers

0
votes

I'm not aware of any way to load the referenced dlls from another folder. If you just want one dll in the destination folder, you could use ILMerge (available via NuGet) to merge the primary output assembly and referenced assemblies into one dll.