Closed stehlih closed 2 years ago
I have tested the build on a newly created Windows Server 2019 machine in Azure and all worked fine.
After the successful build, for example the AuditPolicies
DSC Configuration existed:
$dscResources = Get-DscResource -Module CommonTasks
$dscResources.Name -contains 'AuditPolicies' #returned true
The integration tests for this particular resource looked fine and I do have a file names localhost_AuditPolicies.mof
in the output folder:
Describing 'AuditPolicies' DSC Resource compiles
[+] 'AuditPolicies' compiles 19.09s
[+] 'AuditPolicies' should have created a mof file 3ms
Do you have the DSC Resource module AuditPolicyDsc
somewhere in the PSModulePath
additionally to output\RequiredModules
?
One way to troubleshoot this is to create a short Config script that uses the missing resource and let it throw all its errors. As Raimund pointed out, this issue is usually an issue with some PSModulePath. Probably worth checking the version of Sampler in use, as if an old version is already loaded/available, it may not bootstrap to a version "new enough".
I have checked my PSModulePath and in my private module path I found installed versions of AuditPolicyDsc and SecurityPolicyDsc. But here are the same versions installed as downloaded by PSDepend from the CommonTasks build.
The reason of the problem are different versions of nuget.exe. The existing versions of AuditPolicyDsc and SecurityPolicyDsc in my private module path were downloaded with NuGet 5.7.0 in February 2021. Now PSDepend downloads a new NuGet 6.0.0. The generated PSGetModuleInfo.xml for each module has a different structure and this is the cause of the error.
Thanks @stehlih, as expected. Maybe when compiling the MOFs we can save, change for the compile time and restore the PSModulePath to prevent these conflicts in the future.
Problem description
After restructure of the repository the local build doesn't work an different PC. The tests of the following DSC resources are not run:
InputObject SideIndicator
AuditPolicies <= SecurityBase <= SecurityPolicies <=
The same code and tests are working with the old repository.
Verbose logs
How to reproduce
Fetch the current repository and make a clean build with .\Build.ps1 -Resolvedependency
Expected behavior
Local build shall be finished without errors
Current behavior
Local build fails on different PCs
Suggested solution
Not a solution but some helpful information to find the problem:
The command "$dscResources = Get-DscResource -Module CommonTasks" at line 1 in DscResources.Tests.ps1 doesn't return the failed DSC resources.
If the command "Import-DscResource -ModuleName AuditPolicyDsc" in AuditPolicies.schema.psm1 is commented out the Get-DscResource command returns the AuditPolicies resource (but the build can't compile it).
Operating system the target node is running
PowerShell version and build the target node is running
Module version used