Gary Heath

Gary Heath

  • NA
  • 15
  • 14.2k

Getting the correct Path to the USB on the deployment machine

Mar 27 2012 1:24 PM
Hopefully somebody can help me out here ... basically I am writing a deployment program and am using the path of the program that is executing in order to access the Folders containing data that I am passing as part of the deployment.

I was using the line

myPath = Path.GetDirectoryName(Application.ExecutablePath);

but as that was failing I am now using this line

myPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);

Both of these work just fine on my (Vista) Desktop & give me the exact path of the executing program. However, when I run the Setup on my (WinXP) laptop via a USB which is coming up as the E: drive, mySetup is NOT set to 

E:\KAELC\mySetup

as I would expect, but it is set to (something like)

C:\Documents And Settings\Gary\Local Settings\Apps\2.0\GPACJD60.Z71\H0J8N8V7.3VK\kael..tion_b7e3cbeea3dd9a25_0001.000_ce512e4defa9e

Can somebody please explain how I get around this ?!?

EDIT : I'm getting the exact same problem when I try to install the Application onto my son's Windows 7 laptop ... neither of these laptops have network or sharing connections, just basic Windows installations.


Answers (1)