Local machine test of MSIX app removes dll's from main project

%3CLINGO-SUB%20id%3D%22lingo-sub-1434256%22%20slang%3D%22en-US%22%3ELocal%20machine%20test%20of%20MSIX%20app%20removes%20dll's%20from%20main%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1434256%22%20slang%3D%22en-US%22%3E%3CP%3EVS%202019%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20added%20a%20MSIX%20project%20to%20my%20solution.%20My%20Main%20project%20compiles%20and%20runs%20with%20no%20probems.%3C%2FP%3E%3CP%3EI%20can%20compile%20the%20MSIX%20project%20with%20no%20problems.%3C%2FP%3E%3CP%3EWhen%20I%20Start%20on%20Local%20Machine%2C%20the%20MSIX%20project%20displays%20the%20Main%20project%2C%20but%20says%20a%20dll%20is%20missing.%3C%2FP%3E%3CP%3EWhen%20I%20return%20to%20the%20Main%20project%2C%20certain%20dll's%20are%20missing%20from%20the%20reference%20(although%20not%20the%20dll%20MSIX%20said%20was%20missing.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20done%20this%203%20or%204%20times%20with%20the%20same%20results.%3C%2FP%3E%3CP%3EHave%20I%20done%20something%20wrong%3F%3C%2FP%3E%3CP%3EBob%20K.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1434639%22%20slang%3D%22en-US%22%3ERe%3A%20Local%20machine%20test%20of%20MSIX%20app%20removes%20dll's%20from%20main%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1434639%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F686965%22%20target%3D%22_blank%22%3E%40rkamarowski%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhat's%20the%20specific%20error%20you%20get%20at%20when%20you%20try%20run%20the%20app%3F%20And%20if%20you%20go%20to%20the%20output%20directory%20of%20the%20MSIX%20package%20is%20the%20dll%20there%3F%20e.g.%20MSIXProj%5Cbin%5Cx64%5CDebug%5C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETanaka%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1436553%22%20slang%3D%22en-US%22%3ERe%3A%20Local%20machine%20test%20of%20MSIX%20app%20removes%20dll's%20from%20main%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1436553%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F387730%22%20target%3D%22_blank%22%3E%40Tanaka_Jimha%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENo%2C%20the%20dll%20is%20not%20in%20the%20debug%20folder.%20And%20it%20is%20no%20longer%20in%20the%20Main%20project.%20When%20I%20attempt%20to%20add%20the%20dll%20back%20into%20the%20main%20project%20i'm%20getting%20the%20second%20error.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1437787%22%20slang%3D%22en-US%22%3ERe%3A%20Local%20machine%20test%20of%20MSIX%20app%20removes%20dll's%20from%20main%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1437787%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F686965%22%20target%3D%22_blank%22%3E%40rkamarowski%3C%2FA%3E%20The%20addition%20of%20the%20MSIX%20package%20should%20not%20affect%20dlls%20from%20the%20main%20package.%26nbsp%3B%20I'm%20going%20to%20ignore%20that%20report%20in%20my%20comments%20here%2C%20assuming%20something%20else%20was%20going%20on.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20are%20situations%20where%20under%20MSIX%20your%20dlls%20would%20not%20be%20found.%26nbsp%3B%20It%20depends%20on%20how%20the%20non-MSIX%20version%20would%20have%20found%20them%20as%20the%20LoadModule%20function%20will%20operate%20differently.%26nbsp%3B%20A%20summary%20of%20these%20causes%20are%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%26nbsp%3BThe%20working%20directory%20of%20the%20process%20has%20changed.%26nbsp%3B%20Traditional%20apps%20tend%20to%20have%20a%20working%20directory%20set%20to%20the%20directory%20of%20the%20exe%20file.%20LoadModule%20will%20first%20look%20in%20the%20process%20working%20directory%20for%20the%20dll.%26nbsp%3B%20MSIX%20packages%20have%20the%20System32%20set%20as%20the%20working%20directory%2C%20so%20dlls%20in%20the%20primary%20folder%20might%20not%20be%20found.%3C%2FLI%3E%0A%3CLI%3EThe%20working%20directory%20of%20the%20process%20has%20changed.%20The%20shortcut%20lnk%20file%20of%20the%20original%20program%20might%20have%20specifically%20set%20another%20folder%2C%20such%20as%20a%20subfolder%20where%20dlls%20are%20stored%2C%20as%20the%20working%20directory.%26nbsp%3B%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EMSIX%20packages%20have%20the%20System32%20set%20as%20the%20working%20directory%2C%20so%20dlls%20in%20the%20sub%20folder%20might%20not%20be%20found.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EThe%20old%20program%20relied%20on%20a%20change%20to%20the%20PATH%20variable%20to%20inform%20LoadLibrary%20to%20look%20into%20additional%20folders.%26nbsp%3B%20MSIX%20packages%20can's%20set%2Fchange%20environment%20folders%2C%20so%20dlls%20in%20these%20additional%20folders%20might%20not%20be%20found.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EThe%20old%20program%20relied%20on%20setting%20the%20registry%20%22App%20Paths%22%20registration%20for%20you%20process%20as%20a%20way%20to%20tell%20LoadLibrary%20to%20look%20into%20additional%20folders%20when%20a%20certain%20named%20exe%20is%20running.%26nbsp%3B%20MSIX%20doesn't%20support%20this%20registration%20so%20dlls%20in%20these%20additional%20folders%20might%20not%20be%20found.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EItems%201%20%26amp%3B%202%20may%20be%20solved%20by%20adding%20PsfLauncher%20to%20the%20package%20and%20configuring%20your%20shortcut%20to%20target%20Psflauncher.%20In%20the%20config.json%20file%20you%20also%20add%2C%20you%20specify%20your%20target%20application%20exe%20and%20the%20working%20directory%20that%20you%20want.%26nbsp%3B%20A%20value%20of%20%22%22%20gives%20you%20%231.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EItems%203%20%26amp%3B%204%20may%20be%20solve%20by%20adding%20PsfLauncher%20plus%20a%20fixup%20called%20DynamicLibraryFixup.%20This%20fixup%20will%20force%20your%20application%20to%20find%20dlls%20located%20within%20the%20package%2C%20no%20matter%20where%20they%20are.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1438175%22%20slang%3D%22en-US%22%3ERe%3A%20Local%20machine%20test%20of%20MSIX%20app%20removes%20dll's%20from%20main%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1438175%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F146612%22%20target%3D%22_blank%22%3E%40TIMOTHY%20MANGAN%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt's%20fixed!%20I%20was%20able%20to%20include%20the%20sqlite.interop.dll%2C%20and%20now%20it's%20perfect.%20As%20far%20as%20the%20disappearing%20dll's%2C%20it%20hasn't%20happened%20since%20I%20restarted%20the%20solution%2C%20so%20I'll%20assume%20it%20was%20something%20I%20was%20doing%20incorrectly.%3C%2FP%3E%3CP%3EThanks%20everyone%20for%20the%20quick%20responses.%3C%2FP%3E%3CP%3EBob%20K.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

VS 2019

 

I've added a MSIX project to my solution. My Main project compiles and runs with no probems.

I can compile the MSIX project with no problems.

When I Start on Local Machine, the MSIX project displays the Main project, but says a dll is missing.

When I return to the Main project, certain dll's are missing from the reference (although not the dll MSIX said was missing.

 

I've done this 3 or 4 times with the same results.

Have I done something wrong?

Bob K.

4 Replies

@rkamarowski 

 

What's the specific error you get at when you try run the app? And if you go to the output directory of the MSIX package is the dll there? e.g. MSIXProj\bin\x64\Debug\

 

Tanaka

@Tanaka_Jimha 

No, the dll is not in the debug folder. And it is no longer in the Main project. When I attempt to add the dll back into the main project i'm getting the second error.

@rkamarowski The addition of the MSIX package should not affect dlls from the main package.  I'm going to ignore that report in my comments here, assuming something else was going on.

 

There are situations where under MSIX your dlls would not be found.  It depends on how the non-MSIX version would have found them as the LoadModule function will operate differently.  A summary of these causes are:

  1.  The working directory of the process has changed.  Traditional apps tend to have a working directory set to the directory of the exe file. LoadModule will first look in the process working directory for the dll.  MSIX packages have the System32 set as the working directory, so dlls in the primary folder might not be found.
  2. The working directory of the process has changed. The shortcut lnk file of the original program might have specifically set another folder, such as a subfolder where dlls are stored, as the working directory. MSIX packages have the System32 set as the working directory, so dlls in the sub folder might not be found.
  3. The old program relied on a change to the PATH variable to inform LoadLibrary to look into additional folders.  MSIX packages can's set/change environment folders, so dlls in these additional folders might not be found.
  4. The old program relied on setting the registry "App Paths" registration for you process as a way to tell LoadLibrary to look into additional folders when a certain named exe is running.  MSIX doesn't support this registration so dlls in these additional folders might not be found.

 

Items 1 & 2 may be solved by adding PsfLauncher to the package and configuring your shortcut to target Psflauncher. In the config.json file you also add, you specify your target application exe and the working directory that you want.  A value of "" gives you #1.

 

Items 3 & 4 may be solve by adding PsfLauncher plus a fixup called DynamicLibraryFixup. This fixup will force your application to find dlls located within the package, no matter where they are.

@TIMOTHY MANGAN 

It's fixed! I was able to include the sqlite.interop.dll, and now it's perfect. As far as the disappearing dll's, it hasn't happened since I restarted the solution, so I'll assume it was something I was doing incorrectly.

Thanks everyone for the quick responses.

Bob K.