I had a strange error today using the Desktop App Converter with the parameters given from the Store for Business.
The conversion would fail with the following error:
I’m not sure why this fails as the PackageName is provided by the store and should be valid. An answer on stackoverflow suggested to use a different value for the PackageName parameter and then edit the manifest.
I don’t like this method as manual modifications of the manifest often leads to errors when submitting the application to the store.
So let’s have a look and see why we’re getting this error.
I searched for E_MANIFEST_USE_DEFAULT_VALUE_FAILED in the DesktopAppConverter folder and found 1 occurence in ManifestOps.ps1.
From a look at the code it wasn’t immediately clear where the validation failed so I decided to debug it.
I launched the DesktopAppConverter from the PowerShell ISE and set a breakpoint just before the
try
{
Set-ManifestPropertyHelper -PropertyName $PropertyName -PropertySetMethod $PropertySetMethod -Value $Value -Logger $Logger
}
catch
{
$Logger.RaiseUserException($PSCmdlet.MyInvocation.MyCommand.Name, "E_MANIFEST_SET_PROPERTY_FAILED", @($PropertyName, $value, $ParameterNameOfValue, $DescriptionLink), [System.ArgumentException].FullName)
}
Then I stepped through the code until I reached this part:
[void] SetPackageIdentityName($value)
{
$this._manifest.Package.Identity.Name = $value
$this.Validate()
}
Then I stepped into $this.Validate() which throws the actual error and it had the following text:
Error found in XMLThe 'Name' attribute is invalid - The value 'Company.ApplicationIdentifierXXXXXXXXXX' is invalid according to its datatype 'http://schemas.microsoft.com/appx/manifest/types:ST_PackageName' - The actual length is greater than the MaxLength value.Ah so there is a constraint on the PackageName length!
So let’s have a look at the XSD file and see what the constraints are for ST_PackageName. I search for ST_PackageName in all *.xsd files in the DesktopAppConverter and found it in AppxManifestTypes.xsd :
<xs:simpleType name="ST_PackageName">
< xs:restriction base="ST_AsciiIdentifier">
< xs:minLength value="3"/>
< xs:maxLength value="50"/>
</xs:restriction>
< /xs:simpleType>
So the issue in here is that the PackageName I used was longer that 50 characters!
Now there’s 2 solutions from here and that’s either reduce the PackageName length or specify an alternative, shorter, name by adding the -AppId switch. E.g. -AppId "MyApplication".
Thank you, Havarti! 3