Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error during the CompileRootConfiguration step #2

Open
VishalKuruganti opened this issue Nov 16, 2023 · 1 comment
Open
Assignees
Labels
question Further information is requested

Comments

@VishalKuruganti
Copy link

VishalKuruganti commented Nov 16, 2023

Hello,
As pointed out in the Getting Started doc, I've configured an app registration with certificate authentication , assigned the correct API permissions and granted the Global Administrator role. I have configured the VM to use certificate based authentication.

I'm trying to run the build.ps1 script after making the following changes to the source code present in the /main branch:

  1. Adding AzTenantId, AzTenantName ,AzSubscriptionId, AzKeyVaultName, AzKeyVaultTenantId, AzKeyVaultServicePrincipalApplicationId, AzWorkerServicePrincipalApplicationId to Azure.yml
  2. Modified Configurations.yml file to only include cAADGroup in source\1-AllTenantsConfig\AzureAd\Configurations.yml and source\2-EnvironmentConfig\Dev\AzureAd\Configurations.yml

I'm facing the following error when I run the build.ps1 file in PowerShell 5.1 as an admin

ERROR: Cannot convert argument "module", with value: "System.Object[]", for "GetCachedClassesForModule" to type "System.Management.Automation.PSModuleInfo": "Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Management.Automation.PSModuleInfo"."
At C:\Git\DSC\output\RequiredModules\Sampler.DscPipeline\0.2.0\tasks\CompileRootConfiguration.build.ps1:44 char:1
+ task CompileRootConfiguration {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build FAILED. 15 tasks, 1 errors, 0 warnings 00:01:00.5359099
C:\Git\DSC\output\RequiredModules\InvokeBuild\5.10.4\Invoke-Build.ps1 : Cannot convert argument "module", with value: "System.Object[]", for "GetCachedClassesForModule" to type "System.Management.Automation.PSModuleInfo": "Cannot    
convert the "System.Object[]" value of type "System.Object[]" to type "System.Management.Automation.PSModuleInfo"."
At C:\Git\DSC\build.ps1:511 char:9
+         Invoke-Build @PSBoundParameters -Task $Tasks -File $MyInvocat ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument,Invoke-Build.ps1

Attached the log file for reference
CompileRootConfiguration.log

Looking forward to hearing back

@raandree raandree self-assigned this Nov 29, 2023
@raandree raandree added the question Further information is requested label Nov 29, 2023
@raandree
Copy link
Owner

Sorry for the late reply. The build works fine for me so I cannot say for sure what the issue is on your side.

But, my guess is this: The method GetCachedClassesForModule expects a System.Management.Automation.PSModuleInfo object. It seems there are multiple versions of some module available on the build machine based on your error message. The input seems to be an array of System.Management.Automation.PSModuleInfo which cannot be casted into a single object of that type.

Can you run the build again, please? If the build fails again, can you share me the content of the $PSModulePath variable?

$env:pSModulePath -split ';'

Do you know of any duplicate modules on your build machine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants