'How to import a .psd1 in a .psm1 using classes?

I am trying to require a .dll inside a .psm1 module.

I am using PS classes. So, my .psm1 module is a class and I'm trying to use a method from the dll inside that class.

I have the the .psd1 require the dll like this:

RequiredAssemblies = @('..\Assets\dll\Newtonsoft.Json.Schema.dll')

When I run my script (I am running it from another .ps1 that is using module myModule.psm1), I get this error:

Unable to find type [Newtonsoft.Json.Schema.JSchema]

What am I doing wrong?



Solution 1:[1]

Instead of using module 'myModule.psm1' use using module 'myModule.psd1'.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jsnoobie