How to properly escape a comma in makeappx.exe package process?

%3CLINGO-SUB%20id%3D%22%5C%26quot%3Blingo-sub-3149121%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3EHow%20to%20properly%20escape%20a%20comma%20in%20makeappx.exe%20package%20process%3F%26lt%3B%5C%2Flingo-sub%26gt%3B%3CLINGO-BODY%20id%3D%22%5C%26quot%3Blingo-body-3149121%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CP%3EWhen%20trying%20to%20package%20up%20a%20UWP%20application%2C%20we%20have%20our%20signing%20certificate%20specified%20in%20the%20Publisher%20section%20of%20the%20manifest.%20Unfortunately%2C%20our%20CN%20and%20Organization%20both%20have%20commas%20in%20the%20value.%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EExample%3A%26lt%3B%5C%2FSTRONG%26gt%3B%3CBR%20%2F%3E%3CIDENTITY%20name%3D%22%26quot%3BPKProtectExplorerIntegration%26quot%3B%22%20publisher%3D%22%26quot%3BCN%3DMSFT%2C%22%20inc%3D%22%22%3E%3C%2FIDENTITY%3E%26lt%3B%5C%2FP%26gt%3B%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EWhen%20we%20try%20to%20run%20makeappx.exe%20pack%20%2Fd%20Test%20%2Fp%20Test.msix%20%2Fnv%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EWe%20see%20this%20error%20in%20the%20output%20because%20of%20the%20commas%3A%3CBR%20%2F%3E%3CSTRONG%3EOutput%3A%26lt%3B%5C%2FSTRONG%26gt%3B%3CBR%20%2F%3EMakeAppx%20%3A%20error%3A%20Error%20info%3A%20error%20C00CE169%3A%20App%20manifest%20validation%20error%3A%20The%20app%20manifest%20must%20be%20valid%20as%20per%20schema%3A%20Line%2014%2C%20Column%2049%2C%20Reason%3A%20'CN%3DMSFT%2C%20INC%2C%20O%3DMSFT%2C%20INC%2C%20C%3DUS'%20violates%20pattern%20constraint%20of%20'(CN%7CL%7CO%7COU%7CE%7CC%7CS%7CSTREET%7CT%7CG%7CI%7CSN%7CDC%7CSERIALNUMBER%7CDescription%7CPostalCode%7CPOBox%7CPhone%7CX21Address%7CdnQualifier%7C(OID.(0%7C%5B1-9%5D%5B0-9%5D%3CEM%3E)(.(0%7C%5B1-9%5D%5B0-9%5D%26lt%3B%5C%2FEM%26gt%3B))%2B))%3D((%5B%5E%2C%2B%3D%22%26lt%3B%26gt%3B%23%3B%5D)%2B%7C%22.%3CEM%3E%22)(%2C%20((CN%7CL%7CO%7COU%7CE%7CC%7CS%7CSTREET%7CT%7CG%7CI%7CSN%7CDC%7CSERIALNUMBER%7CDescription%7CPostalCode%7CPOBox%7CPhone%7CX21Address%7CdnQualifier%7C(OID.(0%7C%5B1-9%5D%5B0-9%5D%26lt%3B%5C%2FEM%26gt%3B)(.(0%7C%5B1-9%5D%5B0-9%5D%3CEM%3E))%2B))%3D((%5B%5E%2C%2B%3D%22%26lt%3B%26gt%3B%23%3B%5D)%2B%7C%22.%26lt%3B%5C%2FEM%26gt%3B%22)))*'.%3CBR%20%2F%3EThe%20attribute%20'Publisher'%20with%20value%20'CN%3DMSFT%2C%20INC%2C%20O%3DMSFT%2C%20INC%2C%20C%3DUS'%20failed%20to%20parse.%26lt%3B%5C%2FP%26gt%3B%3C%2FEM%3E%3C%2FEM%3E%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EHow%20do%20we%20properly%20escape%20a%20comma%20in%20the%20Publisher%20string%3F%26lt%3B%5C%2FP%26gt%3B%26lt%3B%5C%2Flingo-body%26gt%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3C%2FLINGO-SUB%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3149121%22%20slang%3D%22en-US%22%3EHow%20to%20properly%20escape%20a%20comma%20in%20makeappx.exe%20package%20process%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3149121%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20trying%20to%20package%20up%20a%20UWP%20application%2C%20we%20have%20our%20signing%20certificate%20specified%20in%20the%20Publisher%20section%20of%20the%20manifest.%20Unfortunately%2C%20our%20CN%20and%20Organization%20both%20have%20commas%20in%20the%20value.%3C%2FP%3E%3CP%3E%3CSTRONG%3EExample%3A%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CIDENTITY%20name%3D%22%26quot%3BPKProtectExplorerIntegration%26quot%3B%22%20publisher%3D%22%26quot%3BCN%3DMSFT%2C%22%20inc%3D%22%22%3E%3C%2FIDENTITY%3E%3C%2FP%3E%3CP%3EWhen%20we%20try%20to%20run%20makeappx.exe%20pack%20%2Fd%20Test%20%2Fp%20Test.msix%20%2Fnv%3C%2FP%3E%3CP%3EWe%20see%20this%20error%20in%20the%20output%20because%20of%20the%20commas%3A%3CBR%20%2F%3E%3CSTRONG%3EOutput%3A%3C%2FSTRONG%3E%3CBR%20%2F%3EMakeAppx%20%3A%20error%3A%20Error%20info%3A%20error%20C00CE169%3A%20App%20manifest%20validation%20error%3A%20The%20app%20manifest%20must%20be%20valid%20as%20per%20schema%3A%20Line%2014%2C%20Column%2049%2C%20Reason%3A%20'CN%3DMSFT%2C%20INC%2C%20O%3DMSFT%2C%20INC%2C%20C%3DUS'%20violates%20pattern%20constraint%20of%20'(CN%7CL%7CO%7COU%7CE%7CC%7CS%7CSTREET%7CT%7CG%7CI%7CSN%7CDC%7CSERIALNUMBER%7CDescription%7CPostalCode%7CPOBox%7CPhone%7CX21Address%7CdnQualifier%7C(OID.(0%7C%5B1-9%5D%5B0-9%5D%3CEM%3E)(.(0%7C%5B1-9%5D%5B0-9%5D%3C%2FEM%3E))%2B))%3D((%5B%5E%2C%2B%3D%22%26lt%3B%26gt%3B%23%3B%5D)%2B%7C%22.%3CEM%3E%22)(%2C%20((CN%7CL%7CO%7COU%7CE%7CC%7CS%7CSTREET%7CT%7CG%7CI%7CSN%7CDC%7CSERIALNUMBER%7CDescription%7CPostalCode%7CPOBox%7CPhone%7CX21Address%7CdnQualifier%7C(OID.(0%7C%5B1-9%5D%5B0-9%5D%3C%2FEM%3E)(.(0%7C%5B1-9%5D%5B0-9%5D%3CEM%3E))%2B))%3D((%5B%5E%2C%2B%3D%22%26lt%3B%26gt%3B%23%3B%5D)%2B%7C%22.%3C%2FEM%3E%22)))*'.%3CBR%20%2F%3EThe%20attribute%20'Publisher'%20with%20value%20'CN%3DMSFT%2C%20INC%2C%20O%3DMSFT%2C%20INC%2C%20C%3DUS'%20failed%20to%20parse.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20do%20we%20properly%20escape%20a%20comma%20in%20the%20Publisher%20string%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

When trying to package up a UWP application, we have our signing certificate specified in the Publisher section of the manifest. Unfortunately, our CN and Organization both have commas in the value.

Example:
<Identity Name="PKProtectExplorerIntegration" Publisher="CN=MSFT, INC, O=MSFT, INC, C=US" Version="1.0.0.0" />

When we try to run makeappx.exe pack /d Test /p Test.msix /nv

We see this error in the output because of the commas:
Output:
MakeAppx : error: Error info: error C00CE169: App manifest validation error: The app manifest must be valid as per schema: Line 14, Column 49, Reason: 'CN=MSFT, INC, O=MSFT, INC, C=US' 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=MSFT, INC, O=MSFT, INC, C=US' failed to parse.

 

How do we properly escape a comma in the Publisher string?

3 Replies

hi@jackd5O 

I think ,(comma) is not supported to be a part of the publisher name.
This article specifies how publisher attribute should look like. 
 
It has to align with this regex:
 
(CN|L|O|OU|E|C|S|STREET|T|G|I|SN|DC|SERIALNUMBER|(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|(OID\.(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))+))=(([^,+="<>#;])+|".*")))*"
 
[^,+="<>#;] = any symbols like , + = etc are now supported. 

@jackd5O 

I believe you can include the comma by quoting the field. So it would be 'CN="MSFT, INC", O="MSFT, INC", C=US'. To include those inner quotes in the manifest XML, you would need to escape them as &quot; so it would ultimately look like Publisher="CN=&quot;MSFT, INC&quot;, O=&quot;MSFT, INC&quot;, C=US".

Note that the regex says you cannot use special characters, unless you quote them:
([^ ,+="<>#;]+|".*")
means that you can write something without any of those characters, or you can surround the full thing with quotes.