PATH environment not working on PSPICE (Orcad) sequenced package
I sequenced PSPICE 16 (orcad) app. This app has many folders with dlls and it set the environment in the manifest as:
<appv:Extension Category="AppV.EnvironmentVariables">
<appv:EnvironmentVariables>
<appv:Include>
<appv:Variable Name="HOME" Value="[{AppVPackageDrive}]\SPB_Data" />
<appv:Variable Name="CDSROOT" Value="[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite" />
<appv:Variable Name="PATH" Value="%PATH%;%CDSROOT%\tools\PSpice;%CDSROOT%\tools\Capture;%CDSROOT%\tools\bin;%CDSROOT%\OpenAccess\bin\win32\opt;%CDSROOT%\tools\fet\bin;%CDSROOT%\tools\pcb\bin" />
</appv:Include>
</appv:EnvironmentVariables>
This fails when launching some executables like pspice.exe with some dll missing. Procmon show that the path is ignored and it only search the system or user path.
Launching a cmd in the virtualized env of the app, the %CDSROOT% in the path isn't expanded, so I suppose that it may be that the PATH variable is processed before CDSROOT. So I edit the manifest xml in the packager in this way:
<appv:Extension Category="AppV.EnvironmentVariables">
<appv:EnvironmentVariables>
<appv:Include>
<appv:Variable Name="HOME" Value="[{AppVPackageDrive}]\SPB_Data" />
<appv:Variable Name="CDSROOT" Value="[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite" />
<appv:Variable Name="PATH" Value="%PATH%;[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite\tools\PSpice;[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite\tools\Capture;[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite\tools\bin;[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite\OpenAccess\bin\win32\opt;[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite\tools\fet\bin;[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite\tools\pcb\bin" />
</appv:Include>
</appv:EnvironmentVariables>
After repackage and publish in the virtual CMD I see the PATH variable with the rigth content but pspice.exe don't find the dll's again. I read something about env variables in virtual registry in HKLM/Software/Microsoft/Windows/CurrentVersion/SessionManager... and again in the packager I see that PATH had the original value using %CDSROOT%, so I edit this and repackage again, but pspice.exe fails again finding the dlls.
The most curious thing is that in the virtual CMD the PATH variable is working for .exe files but not for .dll ... It is very weird. Of course if I set the system PATH variable (or user PATH) with the pathname of all dirs (using the packageid, packageversion, vfs, etc). the app works.
What I'm doing wrong? Which is the best way to do it? I don't want to use App Paths because I have many executable apps in this package.
Answers (3)
Try using sxstrace
Start the trace
Stop the trace and convert the logs, they will give you an idea of what dll its trying to find and where hopefully.
Or you can shoot in the dark and start copying the missing DLLs to the exe folder location, when a exe is run, it always looks at the base location (where the exe is located) as part of the DLL lookup. Not the nest method, but does the job.
* just saw your post there, lol.
This is my DeploymentConfig
<EnvironmentVariables Enabled="true">
<Include>
<Variable Name="HOME" Value="[{AppVPackageDrive}]\SPB_Data" />
<Variable Name="CDSROOT" Value="[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite" />
<Variable Name="PATH" Value="%PATH%;[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite\tools\PSpice;[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite\tools\Capture;[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite\tools\bin;[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite\OpenAccess\bin\win32\opt;[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite\tools\fet\bin;[{ProgramFilesX64}]\Orcad\Orcad_16.6_Lite\tools\pcb\bin" />
</Include>
This is echo %PATH% in a cmd.exe launching inside virtualized enviromnment (I launch this cmd.exe usion App-V commander:
This is the procmon output when I run pspice from the last cmd (note that the path is working here because I'm not in the dir with pspice.exe:
As you can see, cdn_og1101as.dll is searched in all dirs from PATH but it always returns PATH NOT FOUND
I copy from procmon the path with "C:\Program Files\Orcad\Orcad_16.6_Lite\tools\bin\cdn_og1101as.dll" and paste in the previous cmd and this is the output:
As you can see, pspice.exe doesn't found this file in the same path but the cmd.exe in the virtualized env find it ... It's a bug or something that I can't see?