SOLVED

Need configuration information added to .CONFIG file at MSIX install time.

%3CLINGO-SUB%20id%3D%22lingo-sub-1124732%22%20slang%3D%22en-US%22%3ENeed%20configuration%20information%20added%20to%20.CONFIG%20file%20at%20MSIX%20install%20time.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1124732%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20.NET%20application%20that%20has%20a%20client%20and%20a%20server%20component.%26nbsp%3B%20The%20client%20component%20needs%20to%20know%20where%20the%20server%20component%20is%20located%2C%20i.e.%20machine%20name%20and%20port.%26nbsp%3B%20This%20information%20varies%20according%20to%20the%20customers%20that%20have%20purchased%20this%20application.%26nbsp%3B%20My%20current%20client%20installer%20is%20a%20.MSI%20file.%26nbsp%3B%20This%20installer%20will%20prompt%20the%20user%20for%20the%20server%20machine%20name%20and%20port%2C%20edit%20the%20.CONFIG%20file%2C%20and%20install%20the%20updated%20.CONFIG%20file.%26nbsp%3B%20If%20a%20silent%20install%20is%20used%2C%20then%20the%20information%20is%20passed%20in%20as%20properties.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20create%20a%20MSIX%20package%20that%20allows%20the%20user%20to%20input%20this%20configuration%20information%20and%20update%20the%20.CONFIG%20file%20when%20the%20MSIX%20package%20is%20installed%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1126748%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20configuration%20information%20added%20to%20.CONFIG%20file%20at%20MSIX%20install%20time.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1126748%22%20slang%3D%22en-US%22%3EHi%2C%3CBR%20%2F%3E%3CBR%20%2F%3EIt%E2%80%99s%20not%20possible%20during%20install%20to%20achieve%20this.%20However%2C%20using%20the%20PSF%2C%20you%20can%20add%20a%20custom%20script%20(powershell)%20to%20run%20before%20opening%20the%20application.%3CBR%20%2F%3E%3CBR%20%2F%3ETake%20the%20desired%20input%20from%20the%20script%20and%20change%20the%20file.%20If%20the%20file%20is%20present%20in%20the%20installation%20directory%2C%20you%20must%20also%20create%20a%20redirect%20for%20it%20in%20the%20appdata%20of%20the%20app.%3CBR%20%2F%3E%3CBR%20%2F%3EIn%20Advanced%20Installer%20we%20have%20a%20special%20section%20for%20the%20PSF%20called%20AppCompat%20where%20you%20can%20achieve%20this.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1131822%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20configuration%20information%20added%20to%20.CONFIG%20file%20at%20MSIX%20install%20time.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1131822%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F520914%22%20target%3D%22_blank%22%3E%40harlin000%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20the%20app%20is%20also%20under%20active%20development%20we%20recommend%20moving%20to%20a%20first%20launch%20action%20as%20opposed%20to%20a%20script.%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-1137090%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20configuration%20information%20added%20to%20.CONFIG%20file%20at%20MSIX%20install%20time.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1137090%22%20slang%3D%22en-US%22%3EI%20am%20in%20active%20development.%20Thanks.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1167676%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20configuration%20infomation%20added%20to%20.CONFIG%20file%20at%20MSIX%20install%20time.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1167676%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F520914%22%20target%3D%22_blank%22%3E%40harlin000%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EA%20first%20run%20option%20is%20not%20always%20equivalent%20to%20an%20install%20option%20in%20the%20enterprise.%26nbsp%3B%20In%20that%20environment%20an%20IT%20Admin%20performs%2Fprepares%20the%20install%20and%20end-users%20perform%20that%20first%20run.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20the%20first%20run%20option%2C%20since%20you%20are%20in%20development%20you%20can%20just%20implement%20that%20in%20your%20code%20if%20you%20want.%26nbsp%3B%20Otherwise%2C%20using%20PsfLauncher%20and%20a%20first%20run%20script%20option%20to%20prompt%20will%20do.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20something%20the%20end-user%20never%20sees%20in%20that%20enterprise%20environment%2C%20the%20MSIX%20way%20to%20do%20that%20will%20be%20for%20the%20Enterprise%20Admin%20to%20create%20a%20Modification%20package%20containing%20the%20answers.%20If%20you%20store%20the%20answers%20in%20a%20file%2C%20the%20modification%20package%20would%20just%20contain%20a%20copy%20of%20the%20file%20(however%20the%20file%20must%20be%20located%20in%20a%20VFS%20path%20in%20your%20package).%26nbsp%3B%20If%20you%20store%20answers%20in%20the%20registry%2C%20then%20they%20just%20put%20those%20reg%20settings%20in%20their%20modification%20package.%26nbsp%3B%20The%20package%20is%20deployed%20and%20the%20modification%20package%20is%20also%20deployed%20to%20the%20end-user.%26nbsp%3B%20When%20you%20update%20the%20primary%20application%2C%20as%20long%20as%20the%20info%2Flocations%20don't%20change%2C%20the%20same%20modification%20package%20should%20work%20for%20the%20customer%20without%20having%20to%20touch%20it.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEven%20if%20you%20choose%20the%20first-run%20method%2C%20you%20should%20consider%20if%20the%20Enterprise%20scenario%20can%20be%20used.%26nbsp%3B%20Any%20first-run%20method%20usually%20places%20a%20turd%20in%20the%20registry%2Ffilesystem%20to%20indicate%20it%20has%20already%20run.%26nbsp%3B%20In%20that%20case%2C%20you%20can%20implement%20the%20first-run%2C%20and%20if%20the%20Enterprise%20IT%20creates%20the%20modification%20package%20they%20can%20include%20the%20turd.%26nbsp%3B%20You%20just%20have%20to%20document%20this%20to%20them%20and%20they%20have%20to%20RTFM.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I have a .NET application that has a client and a server component.  The client component needs to know where the server component is located, i.e. machine name and port.  This information varies according to the customers that have purchased this application.  My current client installer is a .MSI file.  This installer will prompt the user for the server machine name and port, edit the .CONFIG file, and install the updated .CONFIG file.  If a silent install is used, then the information is passed in as properties.

 

Is there a way to create a MSIX package that allows the user to input this configuration information and update the .CONFIG file when the MSIX package is installed?

4 Replies
best response confirmed by harlin000 (New Contributor)
Solution
Hi,

It’s not possible during install to achieve this. However, using the PSF, you can add a custom script (powershell) to run before opening the application.

Take the desired input from the script and change the file. If the file is present in the installation directory, you must also create a redirect for it in the appdata of the app.

In Advanced Installer we have a special section for the PSF called AppCompat where you can achieve this.

@harlin000 

 

If the app is also under active development we recommend moving to a first launch action as opposed to a script.

 

John.

I am in active development. Thanks.

@harlin000

 

A first run option is not always equivalent to an install option in the enterprise.  In that environment an IT Admin performs/prepares the install and end-users perform that first run.

 

For the first run option, since you are in development you can just implement that in your code if you want.  Otherwise, using PsfLauncher and a first run script option to prompt will do.

 

For something the end-user never sees in that enterprise environment, the MSIX way to do that will be for the Enterprise Admin to create a Modification package containing the answers. If you store the answers in a file, the modification package would just contain a copy of the file (however the file must be located in a VFS path in your package).  If you store answers in the registry, then they just put those reg settings in their modification package.  The package is deployed and the modification package is also deployed to the end-user.  When you update the primary application, as long as the info/locations don't change, the same modification package should work for the customer without having to touch it.

 

Even if you choose the first-run method, you should consider if the Enterprise scenario can be used.  Any first-run method usually places a turd in the registry/filesystem to indicate it has already run.  In that case, you can implement the first-run, and if the Enterprise IT creates the modification package they can include the turd.  You just have to document this to them and they have to RTFM.