The algorithm for generating an Application ID from filename is needed

%3CLINGO-SUB%20id%3D%22lingo-sub-333936%22%20slang%3D%22en-US%22%3EThe%20algorithm%20for%20generating%20an%20Application%20ID%20from%20filename%20is%20needed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-333936%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20the%20MSIX%20Packaging%20Tool%20creates%20a%20package%2C%20it%20uses%20some%20unknown%20algorithm%20to%20generate%20the%20Application%20Id%20field%20in%20the%20manifest%2C%20presumably%20from%20the%20filename%20of%20the%20exe%20file.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20can%20see%20that%20characters%20are%20set%20to%20upper%20case%2C%20and%20numbers%20are%20turned%20into%20their%20English%20equivalent.%26nbsp%3B%20I've%20also%20noticed%20that%20underscores%20are%20removed%20(and%20possibly%20other%20characters).%26nbsp%3B%20The%20schema%20for%20the%20Manifest%20(%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fuwp%2Fschemas%2Fappxpackage%2Fuapmanifestschema%2Felement-application%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fuwp%2Fschemas%2Fappxpackage%2Fuapmanifestschema%2Felement-application%3C%2FA%3E%3C%2FFONT%3E%20)%20indicates%20the%20actual%20restrictions%20to%20the%20string%20and%20this%20too%20must%20be%20part%20of%20the%20algorithm.%26nbsp%3B%20But%20we%20can't%20be%20sure%20exactly%20what%20the%20tool%20does%20in%20generating%20this%20string.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20include%20a%20PSF%20config.json%20file%20in%20the%20package%20to%20implement%20a%20fixup%2C%20the%20config.json%20file%20%22Application%22%26nbsp%3B%20object%20must%20include%20an%20entry%20with%20an%20Id%20field%20that%20matches%20this%20string.%26nbsp%3B%20But%20sometimes%20we%20want%20to%20generate%20the%20json%20file%20before%20the%20manifest%20exists%20so%20that%20it%20is%20included%20in%20the%20package.%20Currently%20this%20means%20packaging%20once%20to%20find%20the%20correct%20string%2C%20and%20then%20packaging%20it%20again.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20automate%20the%20fixing%20of%20packages%2C%20I'd%20like%20to%20see%20this%20algorithm%20documented.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-335168%22%20slang%3D%22en-US%22%3ERe%3A%20The%20algorithm%20for%20generating%20an%20Application%20ID%20from%20filename%20is%20needed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-335168%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Tim%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20those%20edge%20cases%20have%20not%20been%20common%2C%20the%20items%20to%20address%20them%20are%20still%20pending.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks!%3C%2FP%3E%0A%3CP%3EJames%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-334896%22%20slang%3D%22en-US%22%3ERe%3A%20The%20algorithm%20for%20generating%20an%20Application%20ID%20from%20filename%20is%20needed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-334896%22%20slang%3D%22en-US%22%3E%3CP%3ETo%20clarify%20the%20community%20notes%20are%20not%20an%20official%20doc%20statement.%26nbsp%3B%20We%20will%20look%20into%20make%20this%20a%20public%20doc%2C%20but%20have%20to%20evaluate%20the%20need%20to%20possibly%20change%20it%20and%20impacts%20on%20breaking%20changes.%26nbsp%3B%20So%20the%20notes%20here%20are%20not%20guaranteed%2C%20only%20if%20it%20is%20officially%20in%20the%20support%20documentation.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EJohn.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-334772%22%20slang%3D%22en-US%22%3ERe%3A%20The%20algorithm%20for%20generating%20an%20Application%20ID%20from%20filename%20is%20needed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-334772%22%20slang%3D%22en-US%22%3E%3CP%3EThanks.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMy%20tool%20runs%20during%20monitoring%20mode.%26nbsp%3B%20So%20the%20MPT%20can't%20programmatically%20tell%20me%2C%20unless%20you%20game%20me%20a%20COM%20interface%20to%20ask%20and%20I%20don't%20think%20we%20want%20to%20go%20there..%26nbsp%3B%20And%20my%20tool%20closes%20before%20monitoring%20completes%2C%20so%20me%20telling%20the%20MPT%20tool%20is%20probably%20not%20workable%20either%20(well%2C%20unless%20you%20act%20on%20my%20%22plugin%22%20idea).%20If%20it%20ends%20up%20involving%20manual%20entry%20anywhere%2C%20that%20would%20be%20problematic%20as%20there%20may%20be%20multiple%20entry%20points%20in%20the%20package.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%20I'm%20OK%20with%20duplicating%20your%20algorithm%20as%20long%20as%20it%20is%20documented.%26nbsp%3B%20Good%20start%20so%20far%2C%20but%20I%20know%20we%20need%20the%20following%20(unless%20you%20are%20ignoring%20these%20possible%20issues%20and%20generating%20bad%20packages%20anyway)%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGiven%20the%20manifest%20restrictions%2C%20what%20do%20you%20do%20about%20those%20restrictions%3F%3C%2FP%3E%0A%3CP%3E*%20in%20case%20of%20length%20exceeding%2064%20characters%2C%20do%20you%20truncate%20at%2064%3F%20(or%20maybe%20take%20last%2064%3F)%3C%2FP%3E%0A%3CP%3E*%20in%20cast%20of%20a%20disallowed%20token%2C%20what%20do%20you%20do%3F%20(like%20maybe%20an%20entry%20point%20called%20%22CON.exe%22%3F%22%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-334673%22%20slang%3D%22en-US%22%3ERe%3A%20The%20algorithm%20for%20generating%20an%20Application%20ID%20from%20filename%20is%20needed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-334673%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Tim%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20you%20have%20observed%2C%20the%20operations%20today%20are%3A%3C%2FP%3E%0A%3CP%3E1.%20Find%20the%20exe%20name%2C%20strip%20the%20extension%3C%2FP%3E%0A%3CP%3E2.%20Convert%20to%20uppercase%3C%2FP%3E%0A%3CP%3E3.%20remove%20all%20non%20alphanumeric%20characters%3C%2FP%3E%0A%3CP%3E4.%20translate%20the%20numerals%20to%20corresponding%20English%20words%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20cannot%20guarantee%20that%20this%20will%20stay%20the%20same%20over%20time%20though.%20Though%20we%20can%20probably%20add%20a%20note%20to%20document%20any%20changes%20here%20in%20the%20patch%20notes%20if%20needed.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20your%20purposes%2C%20would%20it%20be%20simpler%20if%20we%20provided%20you%20a%20way%20to%20tell%20the%20tool%20what%20ID%20you%20want%20assigned%20in%20the%20manifest%3F%26nbsp%3B%20I%20suspect%20over%20time%20that%20may%20be%20easier%20to%20script%20against%20than%20trying%20to%20match%20the%20algorithmic%20generation%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks!%3C%2FP%3E%0A%3CP%3EJames%3C%2FP%3E%3C%2FLINGO-BODY%3E
MVP

When the MSIX Packaging Tool creates a package, it uses some unknown algorithm to generate the Application Id field in the manifest, presumably from the filename of the exe file.

 

We can see that characters are set to upper case, and numbers are turned into their English equivalent.  I've also noticed that underscores are removed (and possibly other characters).  The schema for the Manifest (https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-application ) indicates the actual restrictions to the string and this too must be part of the algorithm.  But we can't be sure exactly what the tool does in generating this string.

 

To include a PSF config.json file in the package to implement a fixup, the config.json file "Application"  object must include an entry with an Id field that matches this string.  But sometimes we want to generate the json file before the manifest exists so that it is included in the package. Currently this means packaging once to find the correct string, and then packaging it again.

 

To automate the fixing of packages, I'd like to see this algorithm documented. 

 

Thanks.

4 Replies

Hi Tim,

 

As you have observed, the operations today are:

1. Find the exe name, strip the extension

2. Convert to uppercase

3. remove all non alphanumeric characters

4. translate the numerals to corresponding English words

 

I cannot guarantee that this will stay the same over time though. Though we can probably add a note to document any changes here in the patch notes if needed.

 

For your purposes, would it be simpler if we provided you a way to tell the tool what ID you want assigned in the manifest?  I suspect over time that may be easier to script against than trying to match the algorithmic generation?

 

Thanks!

James

Thanks.

 

My tool runs during monitoring mode.  So the MPT can't programmatically tell me, unless you game me a COM interface to ask and I don't think we want to go there..  And my tool closes before monitoring completes, so me telling the MPT tool is probably not workable either (well, unless you act on my "plugin" idea). If it ends up involving manual entry anywhere, that would be problematic as there may be multiple entry points in the package.

 

So I'm OK with duplicating your algorithm as long as it is documented.  Good start so far, but I know we need the following (unless you are ignoring these possible issues and generating bad packages anyway):

 

Given the manifest restrictions, what do you do about those restrictions?

* in case of length exceeding 64 characters, do you truncate at 64? (or maybe take last 64?)

* in cast of a disallowed token, what do you do? (like maybe an entry point called "CON.exe"?"

To clarify the community notes are not an official doc statement.  We will look into make this a public doc, but have to evaluate the need to possibly change it and impacts on breaking changes.  So the notes here are not guaranteed, only if it is officially in the support documentation.

 

John.

Hi Tim,

 

As those edge cases have not been common, the items to address them are still pending.

 

Thanks!

James