load assembly in DSC class resource

Welcome Forums DSC (Desired State Configuration) load assembly in DSC class resource

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
3 years, 6 months ago.

  • Author
    Posts
  • #24015

    Participant
    Points: 0
    Rank: Member

    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

    Moderator
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    Brilliant.

    Thanks.

The topic ‘load assembly in DSC class resource’ is closed to new replies.