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

Release 4.2.0.0 has incorrect nuspec configuration #178

Closed
mrhockeymonkey opened this issue Oct 31, 2018 · 10 comments
Closed

Release 4.2.0.0 has incorrect nuspec configuration #178

mrhockeymonkey opened this issue Oct 31, 2018 · 10 comments
Labels
question The issue is a question. stale The issue or pull request was marked as stale because there hasn't been activity from the community.

Comments

@mrhockeymonkey
Copy link

ISSUE TITLE:
Release 4.2.0.0 has incorrect nuspec configuration

ISSUE DESCRIPTION:
I cant see where your deployment scripts are but I believe there is an issue when generating a nu-spec file for release. In release 4.1.0.0 the nu-spec was:

  <metadata>
    <id>StorageDsc</id>
    <version>4.1.0.0</version>

However in release 4.2.0.0 it is

  <metadata>
    <id>StorageDsc</id>
    <version>4.2.0</version>

Notice the missing ".0"

The result of this is that the module is installed to C:\Program Files\WindowsPowerShell\Modules\StorageDSC\4.2.0 but the psd1 file has "4.2.0.0" specified and thus makes it an invalid module. Running Get-Module -ListAvailable fails to return 4.2.0.0.

This should be a pretty simple fix. I'm happy to have a look if you can point me in the right direction? I don't see any scripts that deal with packaging this module

Details of the scenario you tried and the problem that is occurring

Tried installing this module from our Artifactory instance using Install-Module. The command completes successfully but the resultant module is not valid and cannot be imported.

Trying to import the module via its psd1 yields the underlying reason

PS D:\Code> Import-Module 'C:\Program Files\WindowsPowerShell\Modules\StorageDsc\4.2.0\Stora
geDsc.psd1'
Import-Module : The ModuleVersion key in module manifest 'C:\Program
Files\WindowsPowerShell\Modules\StorageDsc\4.2.0\StorageDsc.psd1' specifies module version '4.2.0.0'
which does not match its version folder name at 'C:\Program
Files\WindowsPowerShell\Modules\StorageDsc\4.2.0'. Change the value of the ModuleVersion key to match
the version folder name.
At line:1 char:1
+ Import-Module 'C:\Program Files\WindowsPowerShell\Modules\StorageDsc\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (C:\Program File...StorageDsc.psd1:String) [Import-Module
   ], InvalidOperationException
    + FullyQualifiedErrorId : Modules_InvalidModuleManifestVersion,Microsoft.PowerShell.Commands.ImportM
   oduleCommand

Verbose logs showing the problem

Suggested solution to the issue

Update the nu-spec to have the full 4 part version number

The operating system the target node is running

OsName               : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 1803
WindowsBuildLabEx    : 17134.1.amd64fre.rs4_release.180410-1804
OsLanguage           : en-GB
OsMuiLanguages       : {en-GB}

Version and build of PowerShell the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.17134.112
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.112
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version of the DSC module that was used ('dev' if using current dev branch)

N/A

@PlagueHO PlagueHO added the question The issue is a question. label Nov 1, 2018
@PlagueHO
Copy link
Member

PlagueHO commented Nov 1, 2018

Hi @mrhockeymonkey - Leaving off the trailing 0 in the nuspec is actually something Nuget does rather than something we do during the publish process. However, this shouldn't cause a problem when using Install-Module StorageDsc from the PSGallery.

I gave it a try myself and it all looks OK:
image

How did you install the module?

@mrhockeymonkey
Copy link
Author

Indeed you are correct it looks like I don't have the issue when I try from PSGallery on my home laptop. At work we use Artifactory to cache PSGallery modules for internal use (we have no direct internet access). Artifactory is the equivalent of a standard NuGet repository.

I'll test this by spinnig up a separate NuGet server, not Artifactory, and see what happens. There is a chance it's Artifactory at fault.

@PlagueHO
Copy link
Member

PlagueHO commented Nov 2, 2018

Hi @mrhockeymonkey - I use Sonatype Nexus at work which is similar to JFrog Artifactory and we use it to proxy the modules. However, we're using it as a "proxy" rather than a mirror. You could use PSGallery on a machine connected to the internet to pull down the modules using Install-Module and then bring the files into your internal network manually and then use the Publish-Module command to publish them back up to Artifactory.

@stale
Copy link

stale bot commented Dec 2, 2018

This issue has been automatically marked as stale because it has not had activity from the community in the last 30 days. It will be closed if no further activity occurs within 10 days. If the issue is labelled with any of the work labels (e.g bug, enhancement, documentation, or tests) then the issue will not auto-close.

@stale stale bot added the stale The issue or pull request was marked as stale because there hasn't been activity from the community. label Dec 2, 2018
@mrhockeymonkey
Copy link
Author

Hi @PlagueHO feel free to close this (apologies for not replying sooner). As mentioned its a weird quirk with artifactory, turns out this only happens when I install directly from artifactory's cache and not when I use it as a proxy. The only reason I was doing that at all was because i had no way to specify the version I wanted explicitly in Ansible but that is getting solved in ansible/ansible#46516 so no need for this issue anymore.

thanks for your feedback.

@stale stale bot removed the stale The issue or pull request was marked as stale because there hasn't been activity from the community. label Dec 7, 2018
@stale
Copy link

stale bot commented Jan 6, 2019

This issue has been automatically marked as stale because it has not had activity from the community in the last 30 days. It will be closed if no further activity occurs within 10 days. If the issue is labelled with any of the work labels (e.g bug, enhancement, documentation, or tests) then the issue will not auto-close.

@stale stale bot added the stale The issue or pull request was marked as stale because there hasn't been activity from the community. label Jan 6, 2019
@stale
Copy link

stale bot commented Feb 15, 2019

This issue has been automatically closed because it is has not had activity from the community in the last 40 days.

@stale stale bot closed this as completed Feb 15, 2019
@psychonic
Copy link

I just ran into this same issue with ComputerManagementDsc and xWebAdministration, installing packages manually cached from PSGallery in a local file share as a repository. The nuspec has the truncated version number, so the modules install to the wrong folder name.

Leaving off the trailing 0 in the nuspec is actually something Nuget does rather than something we do during the publish process.

Some other Microsoft modules and third-party modules don't seem to have this issue. Are there still no plans to fix it?

@psychonic
Copy link

Looks like there is a separate issue for this at the PSGallery level. More info is at PowerShell/PowerShellGallery#55

@PlagueHO
Copy link
Member

Hi @psychonic - this has been a long time problem with PowerShellGet - but more correctly an annoying behavior of Nuget itself. It will affect all DSC Resource modules published to the PSGallery unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question The issue is a question. stale The issue or pull request was marked as stale because there hasn't been activity from the community.
Projects
None yet
Development

No branches or pull requests

3 participants