Exe file working directory

%3CLINGO-SUB%20id%3D%22lingo-sub-291090%22%20slang%3D%22en-US%22%3EExe%20file%20working%20directory%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-291090%22%20slang%3D%22en-US%22%3E%3CP%3EI%20created%20an%20MSIX%20file%20which%20basically%20contains%20only%20files%20underneath%20a%20folder%20with%20subfolders.%20In%20the%20normal%20situation%20the%20shortcut%20contains%20a%20working%20folder.%20That%20works%20fine.%3C%2FP%3E%3CP%3EBut%20when%20installed%20through%20the%20MSIX%20it%20fails%20because%20the%20default%20folder%20is%20c%3A%5Cwindows%5Csystem32%20and%20cannot%20find%20the%20files%20it%20needs%20resulting%20in%20a%20fatal%20error.%20How%20can%20I%20specify%20the%20working%20folder%20in%20the%20MSIX%3F%20Is%20there%20maybe%20a%20possibility%20in%20the%20manifest%20file%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-313286%22%20slang%3D%22en-US%22%3ERe%3A%20Exe%20file%20working%20directory%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-313286%22%20slang%3D%22en-US%22%3E%3CP%3EA%20third%20(very%20ugly%20option)%20is%20to%20make%20System32%20your%20%22installation%20folder%22.%20Don't%20shoot%20the%20messenger%2C%20I%20said%20ugly.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-292226%22%20slang%3D%22en-US%22%3ERe%3A%20Exe%20file%20working%20directory%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-292226%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Rob%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20think%20I%20understand%20what%20is%20happening%20with%20your%20app%2C%26nbsp%3Bseems%20like%20a%20bug%20in%20our%20tracing%20support%20that%20practically%20hides%20the%20working%20dir%20issue.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20trace%20the%20app%20we%20include%20our%20launcher%20in%20the%20package%2C%20and%20it%20seems%20that%20the%20launcher%20is%20incorrectly%20setting%20the%20working%20dir%20for%20your%20app.%20Since%20in%20your%20case%2C%20we%20already%20know%20you%20need%20to%20fix%20this%2C%20go%20to%20Application%20Details%26nbsp%3Bview%20from%20your%20project%20and%20set%20the%20%22Working%20Directory%22%20field%20to%20the%20folder%20where%20your%20EXE%20is%20located%2C%20as%20you%20can%20see%20in%20the%20attached%20image.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20option%20is%20in%20a%20different%20page%20in%20Advanced%20Installer%20because%20we%20started%20fixing%20this%20working%20dir%20problem%20long%20before%20the%20package%20support%20framework%20was%20announced%20by%20MSFT.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F60883iB66A8CA88D76FA44%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22workingdir.png%22%20title%3D%22workingdir.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%2C%20that%20you%20have%20set%20the%20working%20dir%20in%20Application%20Details%20view%20this%20problem%20should%20be%20gone%2C%20so%20it%20remains%20to%20see%20how%20we%20fix%20the%20second%20issue%2C%20with%20the%20file%20write%20problem.%20Maybe%20you%20can%20send%20me%20the%20app%20so%20we%20can%20reproduce%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20you%20try%20to%20close%20the%20app%20and%20the%20file%20write%20operation%20fails%2C%20isn't%20the%20error%20visible%20and%20highlighted%20in%20the%20log%20as%20in%20our%20demo%20video%3F%20If%20it%20is%20you%20could%20apply%20the%20fix%20and%20save%20the%20project%20and%20only%20afterwards%20kill%20the%20process.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnother%20solution%20is%20to%20directly%20add%20the%20file%20redirection%20fixup%20using%20our%20toolbar%20options%2C%20without%20tracing%20the%20app%2C%20as%20we%20already%20know%20the%20problem%20is%20with%20specific%20file.%20Our%20default%20is%20to%20redirect%20.log%20files%2C%20but%20you%20can%20edit%20that%20extension%20to%20match%20your%20specific%20file%20type.%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20730px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F60884i93CAD3FA20A0B52F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22appcompat.png%22%20title%3D%22appcompat.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-292179%22%20slang%3D%22en-US%22%3ERe%3A%20Exe%20file%20working%20directory%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-292179%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Rob%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20send%20me%20your%20advanced%20installer%20project%20over%20email%20at%20%3CEM%3Ebogdan%20at%20advancedinstaller%20dot%20com%3C%2FEM%3E%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you%20can%20also%20send%20me%20a%20download%20link%20for%20the%26nbsp%3Bmsix%20package%20you%20generated%20that%20would%20be%20great%20too%2C%20if%20not%2C%20we%20will%20try%20to%20see%20what%20is%20the%20problem%20with%20your%20project.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20a%20fixup%20is%20added%20in%20our%20AppCompat%20view%20then%20the%20app%20should%20work%20correctly%20when%20installed%20separately%2C%20just%20as%20it%20did%20when%20you%20use%20the%20trace%20app%20functionality.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-292168%22%20slang%3D%22en-US%22%3ERe%3A%20Exe%20file%20working%20directory%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-292168%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Bogdan%2C%3C%2FP%3E%3CP%3EThanks%20for%20your%20reply.%20We%20have%20an%20Archtecture%20license%20from%20Advanced%20Installer.%20I%20am%20using%20v15.5.%20I%20already%20tried%20it%20the%20way%20shown%20in%20the%20video%20but%20for%20some%20reason%20that%20doesn't%20work.%20When%20I%20follow%20the%20steps%20it%20starts%20running%20the%20application.%20The%20application%20starts%20in%20Advanced%20Installer%20(Trace%20apps)%20but%20not%20when%20I%20create%20the%20MSIX%20and%20run%20it%20after%20installing%20the%20MSIX%2C%20so%20that%20is%20different.%20I%20would%20expect%20that%20these%20two%20situation%20should%20give%20the%20same%20result.%20And%20when%20I%20am%20in%20the%20application%20it%20cannot%20be%20closed%20because%20it%20cannot%20write%20an%20ini%20file.%20Only%20way%20closing%20it%20is%20to%20kill%20the%20process%20and%20then%20Advanced%20Installer%20doesn't%20continue%20the%20fixing%20for%20some%20reason.%3C%2FP%3E%3CP%3ENow%20I%20have%20followed%20the%20instruction%20in%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fnl-nl%2Fwindows%2Fuwp%2Fporting%2Fpackage-support-framework%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fnl-nl%2Fwindows%2Fuwp%2Fporting%2Fpackage-support-framework%3C%2FA%3E%20.%20Then%20I%20get%20the%20working%20directory%20done%20but%20not%20the%20redirection%20unfortunately%20so%20closing%20the%20app%20normally%20doesn't%20work.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-292118%22%20slang%3D%22en-US%22%3ERe%3A%20Exe%20file%20working%20directory%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-292118%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20can%20be%20fixed%20with%20the%20help%20of%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.advancedinstaller.com%2Fmsix-introduction.html%23package-support-framework-aka-psf%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Epackage%20support%20framework%3C%2FA%3E%26nbsp%3B(aka%20PSF).%20This%20is%20a%20project%20microsoft%20launched%20to%20help%20fixup%20apps%20without%20touching%20their%20original%20codebase.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20integrate%20the%20fixes%20manually%2C%20as%20documented%20in%20the%20github%20repo%20(link%20in%20the%20above%20mentioned%20article).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOr%20you%20can%20use%26nbsp%3Bthe%20free%20%3CA%20href%3D%22https%3A%2F%2Fwww.advancedinstaller.com%2Fexpress-edition.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EExpress%20edition%3C%2FA%3E%26nbsp%3B(endorsed%20by%20Microsoft%20as%20you%20can%20see%20in%20the%20video)%20of%20Advanced%20Installer%20to%20automatically%20include%20the%20fixes%2C%20as%20show%20in%20this%20%3CA%20href%3D%22https%3A%2F%2Fwww.advancedinstaller.com%2Fpackage-support-framework.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eexample%20video%3C%2FA%3E.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20support%20is%20available%20for%20free%20for%20all%26nbsp%3Bthe%20fixups%20included%20in%20PSF%20repo%20on%20GitHub%2C%20it%20takes%20you%20only%20a%20few%20clicks%20to%20include%20the%20fixup%20in%20your%20package%2C%20without%20requiring%20any%20prior%20knowledge%20on%20how%20PSF%20works.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESince%20you%20already%20have%20an%20MSIX%20package%2C%20you%20can%20simply%20import%20that%20into%20a%20new%20project%20in%20the%20Express%20edition%2C%20to%20speed%20up%20the%20process%2C%20instead%20of%20converting%20your%20app%20all%20over%20again.%20You%20need%20to%20start%20from%20%3CSTRONG%3EImport%3C%2FSTRONG%3E%20section%2C%20%3CEM%3EUWP%20AppX%3C%2FEM%3E%20project%20(it%20also%20supports%20MSIX%2C%20but%20the%20GUI%20hasn't%20been%20refreshed%20yet)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20786px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F60861i00DFB2EDD96CE081%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22import.png%22%20title%3D%22import.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CEM%3EP.S.%20Disclaimer%3A%20I%20work%20on%20the%20team%20building%20Advanced%20Installer%2C%20you%20can%20see%20more%20cool%20MSIX%20features%20in%20my%20recent%20%3CA%20href%3D%22https%3A%2F%2Fmyignite.techcommunity.microsoft.com%2Fsessions%2F67612%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EIgnite%20talk%3C%2FA%3E.%3C%2FEM%3E%3C%2FP%3E%3CP%20class%3D%22lia-img-tmp-id-1%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

I created an MSIX file which basically contains only files underneath a folder with subfolders. In the normal situation the shortcut contains a working folder. That works fine.

But when installed through the MSIX it fails because the default folder is c:\windows\system32 and cannot find the files it needs resulting in a fatal error. How can I specify the working folder in the MSIX? Is there maybe a possibility in the manifest file?

5 Replies

This can be fixed with the help of the package support framework (aka PSF). This is a project microsoft launched to help fixup apps without touching their original codebase.

 

You can integrate the fixes manually, as documented in the github repo (link in the above mentioned article).

 

Or you can use the free Express edition (endorsed by Microsoft as you can see in the video) of Advanced Installer to automatically include the fixes, as show in this example video.

 

This support is available for free for all the fixups included in PSF repo on GitHub, it takes you only a few clicks to include the fixup in your package, without requiring any prior knowledge on how PSF works.

 

Since you already have an MSIX package, you can simply import that into a new project in the Express edition, to speed up the process, instead of converting your app all over again. You need to start from Import section, UWP AppX project (it also supports MSIX, but the GUI hasn't been refreshed yet)

 

import.png

 


P.S. Disclaimer: I work on the team building Advanced Installer, you can see more cool MSIX features in my recent Ignite talk.

 

 

Hi Bogdan,

Thanks for your reply. We have an Archtecture license from Advanced Installer. I am using v15.5. I already tried it the way shown in the video but for some reason that doesn't work. When I follow the steps it starts running the application. The application starts in Advanced Installer (Trace apps) but not when I create the MSIX and run it after installing the MSIX, so that is different. I would expect that these two situation should give the same result. And when I am in the application it cannot be closed because it cannot write an ini file. Only way closing it is to kill the process and then Advanced Installer doesn't continue the fixing for some reason.

Now I have followed the instruction in https://docs.microsoft.com/nl-nl/windows/uwp/porting/package-support-framework . Then I get the working directory done but not the redirection unfortunately so closing the app normally doesn't work.

Hi Rob,

 

Can you send me your advanced installer project over email at bogdan at advancedinstaller dot com?

 

If you can also send me a download link for the msix package you generated that would be great too, if not, we will try to see what is the problem with your project.

 

If a fixup is added in our AppCompat view then the app should work correctly when installed separately, just as it did when you use the trace app functionality.

 

Hi Rob,

 

I think I understand what is happening with your app, seems like a bug in our tracing support that practically hides the working dir issue.

 

To trace the app we include our launcher in the package, and it seems that the launcher is incorrectly setting the working dir for your app. Since in your case, we already know you need to fix this, go to Application Details view from your project and set the "Working Directory" field to the folder where your EXE is located, as you can see in the attached image.

 

This option is in a different page in Advanced Installer because we started fixing this working dir problem long before the package support framework was announced by MSFT.

 

workingdir.png

 

Now, that you have set the working dir in Application Details view this problem should be gone, so it remains to see how we fix the second issue, with the file write problem. Maybe you can send me the app so we can reproduce it.

 

When you try to close the app and the file write operation fails, isn't the error visible and highlighted in the log as in our demo video? If it is you could apply the fix and save the project and only afterwards kill the process.

 

Another solution is to directly add the file redirection fixup using our toolbar options, without tracing the app, as we already know the problem is with specific file. Our default is to redirect .log files, but you can edit that extension to match your specific file type.appcompat.png

 

 

 

 

 

A third (very ugly option) is to make System32 your "installation folder". Don't shoot the messenger, I said ugly.