Reputation: 129
I'm trying to use the Microsoft Desktop App Converter (AKA Desktop Bridge) and our publisher name has a comma, space and period in it.
eg. CN="Acme, Inc."
This does not work:
DesktopAppConverter.exe -Installer .\Installer.msi -Destination AppxFolder -PackageName "AcmeApp" -Publisher "CN=Acme, Inc." -Version 1.0.0.0 -MakeAppx
I've tried various ways to escape the quotes like:
-Publisher "CN=\`"Acme`, Inc.\`""
results in:
A positional parameter cannot be found that accepts argument 'Inc.'.
This:
-Publisher 'CN="Acme, Inc."'
results in:
Appx manifest validation failed because of an invalid input: 'Publisher' cannot be assigned a value 'CN=Acme, Inc.' Original Error: 'Exception calling "SetPackageIdentityPublisher" with "1" argument(s): "Validating AppxManifest.xml against schemas failed with error(s): Error found in XML (0): The 'Publisher' attribute is invalid - The value 'CN=Acme, Inc.' is invalid according to its datatype 'http://schemas.microsoft.com/appx/manifest/types:ST_Publisher_2010_v2' - The Pattern constraint failed.
This:
-Publisher 'CN="Acme\`, Inc."'
results in:
Appx manifest validation failed because of an invalid input: 'Publisher' cannot be assigned a value 'CN=Acme`, Inc.' Original Error: 'Exception calling "SetPackageIdentityPublisher" with "1" argument(s): "Validating AppxManifest.xml against schemas failed with error(s):
Error found in XML (0): The 'Publisher' attribute is invalid - The value 'CN=Acme`, Inc.' is invalid according to its datatype 'http://schemas.microsoft.com/appx/manifest/types:ST_Publisher_2010_v2' - The Pattern constraint failed.
This:
-Publisher "CN=Acme, Inc."
results in:
Appx manifest validation failed because of an invalid input: 'Publisher' cannot be assigned a value 'CN=Acme, Inc.' Original Error: 'Exception calling "SetPackageIdentityPublisher" with "1" argument(s): "Validating AppxManifest.xml against schemas failed with error(s): Error found in XML (0): The 'Publisher' attribute is invalid - The value 'CN=Acme, Inc.' is invalid according to its datatype 'http://schemas.microsoft.com/appx/manifest/types:ST_Publisher_2010_v2' - The Pattern constraint failed.
This:
-Publisher "CN='Acme\, Inc.'"
results in:
A positional parameter cannot be found that accepts argument 'System.Object[]'.
This:
-Publisher "CN=Acme\, Inc."
results in:
Appx manifest validation failed because of an invalid input: 'Publisher' cannot be assigned a value 'CN=Acme\, Inc.' Original Error: 'Exception calling "SetPackageIdentityPublisher" with "1" argument(s): "Validating AppxManifest.xml against schemas failed with error(s): Error found in XML (0): The 'Publisher' attribute is invalid - The value 'CN=Acme\, Inc.' is invalid according to its datatype 'http://schemas.microsoft.com/appx/manifest/types:ST_Publisher_2010_v2' - The Pattern constraint failed.
It's pretty annoying because we need the publisher name to be set perfectly or else the signing won't work afterwards because it won't match the publisher name in our code signing cert.
What's the correct way to do this?
Upvotes: 3
Views: 1390
Reputation: 71
Including a 'comma' in the publisher argument for the Desktop App Convert (DAC) is not supported. This is because this value is used to populate the Publisher element in the Identity node in the AppxManifest.xml file
(included in the APPX produced by the DAC.
A test in a sample AppxManifest.xml
file is as follows:
<Identity Version="0.0.0.2" Publisher="CN=Awesome,Apps-Inc" ProcessorArchitecture="x86" Name="MyNotesFW"/>
When you try to create the APPX file, you will get this error:
MakeAppx : error: Error info: error C00CE169: App manifest validation error: The app manifest must be valid as per schema: Line 3, Column 58, Reason: 'CN=Awesome,Apps-Inc' violates pattern constraint of '(CN|L|O|OU|E|C|S|STREET|T|G|I|SN|DC|SERIALNUMBER|Description|PostalCode|POBox|Phone|X21Address|dnQualifier|(OID\.(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))+))=(([^,+="<>#;])+|".*")(, ((CN|L|O|OU|E|C|S|STREET|T|G|I|SN|DC|SERIALNUMBER|Description|PostalCode|POBox|Phone|X21Address|dnQualifier|(OID\.(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))+))=(([^,+="<>#;])+|".*")))*'.
**The attribute 'Publisher' with value 'CN=Awesome,Apps-Inc' failed to parse.**
Upvotes: 1
Reputation: 1
None of the above worked for me.
I tried double ""
around the full company name and it worked finally!
'CN=""NAME, INC.""'
Don't forget the '
before CN and after the closing ""
Upvotes: 0
Reputation: 1778
According to Microsoft documentation about appxmanifest you can include comma in publisher name without a problem as long as the publisher name is surrounded by quotes ("):
https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx
So the real question is how to pass publisher name with quotes to AppConverter.
The solution seem to be to represent " with \"\" when passing publisher like this:
-Publisher 'CN=\"\"Company, Name\"\"'
The full command here:
DesktopAppConverter.exe -Installer myInstaller.exe -InstallerArguments "/S" -Destination . -PackageName "MyApp" -Publisher 'CN=\"\"Company, Name\"\"' -Version 0.0.0.1 -MakeAppx
However there seems to be a bug in DesktopAppConverter. The result I get is this:
CN="Company, Name
The 2nd " is missing from the result. I'm not sure why DesktopAppConverter is unable to recognize the 2nd \"\" special character, but that's the case and so we're unfortunately stuck here.
Update: Found the solution. With trial and error I found out that adding double quote "" helps in recognizing the 2nd quote. So the following works:
-Publisher 'CN=\"\"Company, Name""\"\"'
Upvotes: 0
Reputation: 200473
You need to escape the comma in addition to the double quotes. Also, put the enire common name in single quotes instead of double quotes, so you don't need to escape twice (for PowerShell and Active Directory).
... -Publisher 'CN=\"Acme\, Inc.\"' ...
See this article by Richard L. Mueller for more information about escaping characters in distinguished names.
Upvotes: 0