load assembly in DSC class resource

Tagged: ,

This topic contains 2 replies, has 2 voices, and was last updated by  Kris Parr 2 years, 5 months ago.

  • Author
    Posts
  • #24015

    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

    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

    Kris Parr
    Participant

    Brilliant.

    Thanks.

You must be logged in to reply to this topic.