chocolatey / cChoco

Community resource to manage Chocolatey
Apache License 2.0
154 stars 99 forks source link

Include exported DSC resources in the module manifest file #172

Open FLeven opened 1 year ago

FLeven commented 1 year ago

Describe the bug On push to private repo

WARNING: This module 'C:\Users\fladmin\AppData\Local\Temp\1886670852\cChoco\cChoco.psd1' has exported DscResources. As 
a best practice, include exported DSC resources in the module manifest file(.psd1). If your PowerShell version is 
higher than 5.0, run Update-ModuleManifest -DscResourcesToExport to update the manifest with ExportedDscResources 
field.

To Reproduce Steps to reproduce the behavior:

Register-PSRepository -Name pwsh -InstallationPolicy Trusted -SourceLocation https://nexus.local/repository/pwsh/ -PackageManagementProvider nuget -PublishLocation https://nexus.local/repository/pwsh/

Publish-Module -Name ".\cchoco" -Repository pwsh -NuGetApiKey "123"

Expected behavior Clean push without warnings

Software (please complete the following information):

Tzrlk commented 8 months ago

I suspect this might be causing the error I'm having right now:

ERROR: The PowerShell DSC resource cChocoInstaller from module <cChoco,2.6.0.0> does not exist at the PowerShell module path nor is it registered as a WMI DSC resource.

Will try updating my local manifest copy with the resources and submit a fix if that helps.

Update 1: Turns out that we can't actually add the property at all without breaking powershell compatibility pre 5.0:

Update-ModuleManifest: The ExportedDscResources property is not supported in module manifests on PowerShell versions that are older than 5.0. Remove the value for the parameter 'DscResourcesToExport', and then try again.

Update 2: It also doesn't help with the error I was getting at all.