Click here to Skip to main content
15,885,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a reports folder in my app folder
i need to give thhe path
but i am not able to get the path i always get the path as physical path of application/debug/report
but report folder is in the application root path
Posted

It sounds like you are running your application in debug mode in Visual Studio. In that case, the root path for your application is the debug folder. That is where your exe file is that you are running. If you want to include a directory in your application that has reports, you need to add that to your project or you need to create it manually. When you create a setup project to deploy your application, you will have the option of adding folders at the root of your application.

If you are including files that go with your project, put them in a folder in your application and mark them as content files that should always be copied. Then, when you compile your application, it will create that folder and put those content files in the folder. Then you can reference them using the relative path.

The bottom line is that your project's root folder is not your application's root folder. Instead, your root folder is wherever your exe is running from (in this case, the debug directory). If you want content to be relative to the root of the application's directory, you either need to copy it manually, include it in an install file, or include it in the project and mark it as a content file.
 
Share this answer
 
hi,
you can find root path by using
Application.StartupPath

this is used at both place at client side and your developing side also,
its returns root path of your .exe file.

I Hope this will help you.
All The Best
:)
 
Share this answer
 
Application.StartupPath.ToLower.Replace("\bin\debug", "").Replace("\bin\release", "")
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900