Msix more file install

%3CLINGO-SUB%20id%3D%22lingo-sub-2275568%22%20slang%3D%22en-US%22%3EMsix%20more%20file%20install%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2275568%22%20slang%3D%22en-US%22%3EI%20have%20a%20setup.exe%20with%20msix%20tool%20packaging%20in%20program%20files%20%5C%20windowsapps%203%20file%3CBR%20%2F%3Emyprog.exe%3CBR%20%2F%3Emydb.mdb%3CBR%20%2F%3Emyimg.img%3CBR%20%2F%3Ewhen%20I%20launch%20my%20myprog.%20exe%20says%20it%20can't%20find%20mydb.mdb%20and%20from%20what%20I%20understand%20it%20doesn't%20find%20it%20due%20to%20permissions%20issue.%20How%20is%20it%20resolved%3F%20Should%20I%20upload%20to%20windows%20store%20...%20It%20seems%20strange%20that%20I%20can%20only%20access%20myprog.%20exe%20and%20myprog.%20exe%20cannot%20link%20myimg.%20img%20and%20mydb.%20mdb.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2281162%22%20slang%3D%22en-US%22%3ERe%3A%20Msix%20more%20file%20install%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2281162%22%20slang%3D%22en-US%22%3EThanks%20to%20all%20I%20had%20to%20use%20a%20software%20to%20create%20msix%20package%20other%20than%20msix%20tool%20packaging%20and%20everything%20was%20much%20simpler%20and%20I%20didn't%20have%20to%20change%20anything.%20Thanks%20to%20your%20good%20advice%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2277457%22%20slang%3D%22en-US%22%3ERe%3A%20Msix%20more%20file%20install%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2277457%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1027980%22%20target%3D%22_blank%22%3E%40lcdiet%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhile%20you'd%20need%20to%20debug%20to%20be%20sure%2C%20in%20all%20likelihood%20the%20source%20code%20expects%20the%20working%20directory%20of%20the%20process%20to%20be%20the%20folder%20that%20holds%20the%20exe%20file%2C%20and%20the%20code%20references%20the%20file%20without%20and%20folders.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETraditional%20installer%20shortcuts%26nbsp%3B%3CEM%3Eusually%3C%2FEM%3E%20will%20cause%20the%20process%20to%20start%20with%20the%20working%20directory%20of%20the%20process%20to%20be%20that%20folder%2C%20but%20under%20MSIX%20--%20by%20default%20--%20start%20menu%20launches%20will%20set%20the%20working%20directory%20to%20be%20the%20Windows%5CSystem32%20folder.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20source%20code%20is%20not%20available%2C%20we%20usually%20solve%20this%20by%20adding%20PsfLauncher%20from%20the%20Package%20Support%20Framework.%26nbsp%3B%20Your%20package%20start%20menu%20item%20should%20point%20to%20PsfLauncher%2C%20which%20is%20then%20configured%20to%20launch%20your%20app%20and%20set%20the%20working%20directory%20as%20you'd%20like.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWith%20source%20code%20access%2C%20you%20can%20modify%20your%20code%2C%20either%20using%20the%20executingassembly%20folder%20(if%20.net%20based)%20or%20by%20adding%20in%20the%20path%20the%20to%20exe%20in%20a%20registry%20string%20which%20the%20app%20reads.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2275680%22%20slang%3D%22en-US%22%3ERe%3A%20Msix%20more%20file%20install%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2275680%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1027980%22%20target%3D%22_blank%22%3E%40lcdiet%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20could%20happen%20if%20your%20app%20relies%20on%20the%20current%20working%20directory%20to%20load%2Fread%20the%20other%20files%2C%20or%20if%20you%20are%20trying%20to%20write%20in%20any%20of%20the%20files.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20a%20simple%20read%20operation%20fails%2C%20than%20you%20might%20need%20to%20specify%20a%20custom%20working%20directory.%20By%20default%20an%20app%20packaged%20as%20MSIX%20is%20launched%20with%20%3CSTRONG%3ESystem32%26nbsp%3B%3C%2FSTRONG%3Eas%20a%20working%20dir.%20The%20MSIX%20packaging%20tool%20does%20not%20have%20an%20option%20to%20edit%20the%20working%20dir%20(from%20what%20I%20know)%2C%26nbsp%3B%20I%20recommend%20you%20use%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.advancedinstaller.com%2Fexpress%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Efree%20Express%20edition%20from%20Advanced%20Installer%3C%2FA%3E%20to%20generate%20the%20MSIX%20package.%20This%20tool%20allows%20you%20%3CA%20href%3D%22https%3A%2F%2Fwww.advancedinstaller.com%2Fmsix-shortcut.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ecustomize%20the%20working%20directory%3C%2FA%3E%20from%20its%20GUI.%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20you%20are%20getting%20the%20error%20because%20the%20application%20is%20trying%20to%20write%20in%20any%20of%20those%20files%2C%20then%20you%20need%20to%20redirect%20the%20app%20(i.e.%20stop%20writing%20in%20the%20installation%20folder%20-%20this%20is%20not%20supported%20by%20MSIX%20packaged%20apps).%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EIf%20you%20have%20the%20source%20code%20of%20your%20app%20and%20can%20modify%20it%2C%20I%20recommend%20you%20configure%20your%20app%20to%20store%20those%20files%20in%20the%20AppData%20user%20folder.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you%20don't%20have%20access%20to%20the%20source%20code%20then%20you%20can%20use%20the%20Package%20Support%20Framework%20(PSF)%20integration%20from%20Advanced%20Installer%20to%20%3CA%20href%3D%22https%3A%2F%2Fwww.advancedinstaller.com%2Fsmart-psf-msix-fixups.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Einject%20a%20file%20redirection%20fixup%3C%2FA%3E%20in%20your%20package.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EMore%20details%20-%20%3CA%20href%3D%22https%3A%2F%2Fwww.advancedinstaller.com%2Fmsix-files-redirection.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehow%20files%20redirections%20work%20with%20MSIX%20and%20PSF%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CEM%3EDisclaimer%3A%20I%20work%20on%20the%20team%20building%20Advanced%20Installer%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor
I have a setup.exe with msix tool packaging in program files \ windowsapps 3 file
myprog.exe
mydb.mdb
myimg.img
when I launch my myprog. exe says it can't find mydb.mdb and from what I understand it doesn't find it due to permissions issue. How is it resolved? Should I upload to windows store ... It seems strange that I can only access myprog. exe and myprog. exe cannot link myimg. img and mydb. mdb.
3 Replies

Hi @lcdiet 

 

This could happen if your app relies on the current working directory to load/read the other files, or if you are trying to write in any of the files.

 

If a simple read operation fails, than you might need to specify a custom working directory. By default an app packaged as MSIX is launched with System32 as a working dir. The MSIX packaging tool does not have an option to edit the working dir (from what I know),  I recommend you use the free Express edition from Advanced Installer to generate the MSIX package. This tool allows you customize the working directory from its GUI.

If you are getting the error because the application is trying to write in any of those files, then you need to redirect the app (i.e. stop writing in the installation folder - this is not supported by MSIX packaged apps).

If you have the source code of your app and can modify it, I recommend you configure your app to store those files in the AppData user folder. 

 

If you don't have access to the source code then you can use the Package Support Framework (PSF) integration from Advanced Installer to inject a file redirection fixup in your package. 

More details - how files redirections work with MSIX and PSF

Disclaimer: I work on the team building Advanced Installer

 

@lcdiet 

 

While you'd need to debug to be sure, in all likelihood the source code expects the working directory of the process to be the folder that holds the exe file, and the code references the file without and folders.

 

Traditional installer shortcuts usually will cause the process to start with the working directory of the process to be that folder, but under MSIX -- by default -- start menu launches will set the working directory to be the Windows\System32 folder.

 

When source code is not available, we usually solve this by adding PsfLauncher from the Package Support Framework.  Your package start menu item should point to PsfLauncher, which is then configured to launch your app and set the working directory as you'd like.

 

With source code access, you can modify your code, either using the executingassembly folder (if .net based) or by adding in the path the to exe in a registry string which the app reads.

Thanks to all I had to use a software to create msix package other than msix tool packaging and everything was much simpler and I didn't have to change anything. Thanks to your good advice