How to find my exe's path?

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Oct 2008
Posts: 57
Reputation: konczuras is an unknown quantity at this point 
Solved Threads: 1
konczuras konczuras is offline Offline
Junior Poster in Training

How to find my exe's path?

 
0
  #1
Mar 18th, 2009
Hello!

I'm trying to create some files in the folder where my exe is located.

This works just fine in VS 2008 C# express, but when I publish the file, (e.g.: D:\Program), it refers to quite an other place (somewhere in my documents and settings' applications folder)

I've tried several different methods (Application.StarupPath, .ExecutablePath, tried the one with System.Reflections), but all resulted the same.

Have you got any ideas?

Thanks in advance!
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 70
Reputation: mcriscolo is an unknown quantity at this point 
Solved Threads: 18
mcriscolo mcriscolo is offline Offline
Junior Poster in Training

Re: How to find my exe's path?

 
0
  #2
Mar 18th, 2009
I take it that when you say "publish", you are using the publish command from the "Build" menu... if that's the case, then yes, when you get the output package from the Publish process, and then install it, it does install it into a subfolder of <SYSTEMDRIVE>\Documents and Settings\User\Local Settings\Apps\2.0. That is the folder you are seeing when you get the value from the "Application.StartupPath" property.

If you just copy your EXE (and any required supporting files) from your "Debug" (or "Release") folder to another location on your machine, the "Application.StartupPath" property will show you the correct location.
-Mike
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 57
Reputation: konczuras is an unknown quantity at this point 
Solved Threads: 1
konczuras konczuras is offline Offline
Junior Poster in Training

Re: How to find my exe's path?

 
0
  #3
Mar 18th, 2009
Thank you, this seems to be the case.

Now, is there any way to define where do I like to install my app?
The setup tool don't allow me anything, just works a little, then it installs to that folder..
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: How to find my exe's path?

 
1
  #4
Mar 19th, 2009
You may have to create a custom deployment package to do this-- the default MSI creator doesn't afford you many options, but the deployment package project does:

http://msdn.microsoft.com/en-us/library/ms228283.aspx
Alex Cavnar, aka alc6379
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 57
Reputation: konczuras is an unknown quantity at this point 
Solved Threads: 1
konczuras konczuras is offline Offline
Junior Poster in Training

Re: How to find my exe's path?

 
0
  #5
Mar 19th, 2009
Thank you very much.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC