Hi, I am looking around to see if anyone else has seen this error when creating DSC class-based resources.
I have a few resources in the same psm1 file. The first couple of resources work normally and I haven’t done anything different in the next resource I am trying to create.
My resource shows up with Get-DscResource properly. However, when I run an Invoke-DscResource -Method Test on it I get an error:
Invoke-DscResource : All classes must have a reference to ConfigurationResource.
My searches don’t show me anything and I just simply don’t see that I have done anything different from any other class-based resource I have create.
Thanks, @Matt2005. Your response pointed me to my solution.
My anomaly was that it was that the DSC successfully applied on my development machine (it’s just a desktop wallpaper, so I was developing live). However, didn’t work on any of my production test machines. Both systems are running Win10. However, my development system is running 1709 (PSVersion: 5.1.16299.248); production test systems are 1703 (PSVersion: 5.1.15063.786).
I had a parameter that was an ArrayList ([System.Collections.ArrayList]) because I was using a dynamic array size. Instead I changed it to [string] and it worked fine. I just had to use the following logic to account for the fixed size: