Click here to Skip to main content
12,752,373 members (34,538 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
Hi i need to give a relative path for the folder in the solution
thsiis the complete path:c:\users\priya.sasidharan\documents\visual studio 2010\Projects\ProjectAddIn3\ProjectAddIn3\Templates\Data.xml
I gave like this@"~\Templates\Data.xml but its not is showing the following error
'C:\Users\priya.sasidharan\Documents\~\ProjectAddIn3\ProjectAddIn3\Templates\Data.xml' could not be found
Posted 20-Feb-13 20:53pm
Updated 20-Feb-13 21:20pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Hello Spriyanair,

Relative path enforces that you know (in the code on runtime) where are you executing from.
During runtime, a relative path will be concatenated with the path of the executable running.

For example using relative path in visual studio will act differently when running in debug mode or in release mode since they operate from different folders.

From your question is seems that your executable is in the folder: C:\Users\priya.sasidharan.AMEX\Documents\
is that the relative path you want your @"~\Templates\Data.xml" to be added to?

spriyanair 21-Feb-13 2:18am
I want this relative path c:\users\priya.sasidharan\documents\visual studio 2010\Projects\

but after documents iam not getting the path
Azziet 21-Feb-13 2:28am
remove space in visual studio 2010 folder name
spriyanair 21-Feb-13 7:32am

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100