PowerShellOrg/Plaster

Test-PlasterManifest 'Error: The 'powerShellVersion' attribute is not declared.'

ephos opened this issue · 4 comments

ephos commented

I have been working to setup a custom PlasterManifest.xml and was attempting the the following.

<newModuleManifest destination='src\${PLASTER_PARAM_ModuleName}.psd1' 
        moduleVersion='$PLASTER_PARAM_ModuleVersion' 
        rootModule='${PLASTER_PARAM_ModuleName}.psm1' 
        author='$PLASTER_PARAM_ModuleAuthor'
        description='$PLASTER_PARAM_ModuleDesc'
        companyName='$PLASTER_PARAM_ModuleCompanyName'
        powerShellVersion='5.1'/>

I tried some different casing options on the attribute but still always seem to get the error below on running Test-PlasterManifest -Path C:\Users\user1\Desktop\PlasterTemplates\MyTestTemplate\PlasterManifest.xml -Verbose

'Error: The 'powerShellVersion' attribute is not declared.'

I did some additional digging and looked in the contained PlasterManifest-v1.xsd schema file and noticed there was no powerShellVersion attribute declared there under the newModuleManifest element. I'm admittedly not super confident in my XML abilities but could this be the issue or am I doing something incorrectly?

Also in the doc I noticed in the NewModuleManifest section the casing was different between the descriptions and the code snip, I wasn't sure if it should be the same there as well.

Environment Stuff Below!

Plaster Version 1.0.1

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

ephos commented

Just for kicks I added that attribute into the schema file and the issue is resolved.

 <xs:element name="newModuleManifest" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                  <xs:documentation>Create a new module manifest file using the New-ModuleManifest command.</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:attribute name="destination" type="xs:string" use="required">
                    <xs:annotation>
                      <xs:documentation>Specifies the relative path, under the destination folder, to where the file will be copied.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="author" type="xs:string">
                    <xs:annotation>
                      <xs:documentation>Specifies the value of the Author property.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="companyName" type="xs:string">
                    <xs:annotation>
                      <xs:documentation>Specifies the value of the CompanyName property.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="powerShellVersion" type="xs:string">
                    <xs:annotation>
                      <xs:documentation>Testing: Specifies the version of PowerShell to use.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="description" type="xs:string">
                    <xs:annotation>
                      <xs:documentation>Specifies the value of the Description property. Note: this field is required for module submissions to the PowerShell Gallery.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="moduleVersion" type="xs:string">
                    <xs:annotation>
                      <xs:documentation>Specifies the value of the ModuleVersion property.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="rootModule" type="xs:string">
                    <xs:annotation>
                      <xs:documentation>Specifies the value of the RootModule property.</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="condition" type="ptd:condition"/>
                  <xs:attribute name="encoding" type="ptd:encoding" default="Default"/>
                </xs:complexType>
              </xs:element>

Wait a tic - it is declared here - https://github.com/PowerShell/Plaster/blob/master/src/Schema/PlasterManifest-v1.xsd#L459

Are you using the officially released 1.01 or are you using source from the GitHub repo?

ephos commented

I am using the officially released copy from the PS Gallery (1.0.1).

That 'splains it then. When we release 1.1.0 it will support this attribute.