load assembly in DSC class resource

Tagged: ,

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Kris Parr Kris Parr 2 years, 1 month ago.

  • Author
    Posts
  • #24015
    Profile photo of Kris Parr
    Kris Parr
    Participant

    When defining a DSC resource using classes, how do I load an assembly so it's types can be used as return values for helper methods ? For example,

     [Microsoft.SqlServer.Management.Smo.ConfigProperty] GetSqlFacet() { ... } 

    I can load the assembly within the methods, but I need something more akin to the using statement in c#.

    Thanks.

  • #24016
    Profile photo of Daniel Krebs
    Daniel Krebs
    Moderator

    My suggestion would be to modify the manifest (something.psd1) of your DSC resource module, uncomment RequiredAssemblies and specify the required assemblies as an array.

    # Assemblies that must be loaded prior to importing this module
    RequiredAssemblies = @('C:\.\xzy.dll','abc.dll')
    
  • #24017
    Profile photo of Kris Parr
    Kris Parr
    Participant

    Brilliant.

    Thanks.

You must be logged in to reply to this topic.