| | |
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:
Solved Threads: 1
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!
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!
•
•
Join Date: Apr 2008
Posts: 70
Reputation:
Solved Threads: 18
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.
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
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
http://msdn.microsoft.com/en-us/library/ms228283.aspx
Alex Cavnar, aka alc6379
![]() |
Similar Threads
- explorer.exe problem - Keeps restarting (Viruses, Spyware and other Nasties)
- Python path HELP (Python)
- How do I get rid of xadsjt offeroptimizer? (Viruses, Spyware and other Nasties)
- Hijack this log - TAPIAP.EXE (Viruses, Spyware and other Nasties)
- RegEdit.exe missing (Windows 95 / 98 / Me)
- problem with svchost.exe (Windows NT / 2000 / XP)
- Internet Explorer won't open log file attached (Viruses, Spyware and other Nasties)
- where can i find a driver for a hitachi GD 2500 (Storage)
- Error Linking KeyLogger.exe (C++)
Other Threads in the C# Forum
- Previous Thread: is there any way to run .net project without compiling?
- Next Thread: how to access dynamically created windows controls?
| Thread Tools | Search this Thread |
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# chat check checkbox client color combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms function gdi+ httpwebrequest image index input install java label list listbox listener mandelbrot math mouseclick mysql networking opening operator parse path photoshop picturebox pixelinversion post programming radians regex remote remoting richtextbox save saving serialization server sleep socket sql statistics stream string table tcp temperature text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






