Click here to Skip to main content
12,241,861 members (45,424 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 wrking.it 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
Edited 20-Feb-13 21:20pm
v3

1 solution

Rate this: bad
 
good
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?

Cheers,
Edo
  Permalink  
Comments
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
   
NOT WRKING

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.160426.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2016
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