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!

8 Years
Discussion Span
Last Post by konczuras

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.


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..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.