Click here to Skip to main content
15,906,081 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Solution with 3 different Projects.One is my Project and another two are related to service.i have one folder in my project.How i can access that folder from my service.(i need the path)

Thanks in advance.
Posted
Comments
Sampath Lokuge 7-Nov-13 7:35am    
Can you explain what are the services (web service or WCF or what)?
njdcjk 8-Nov-13 4:45am    
Iam using Windows Service with FileWatcher.So i need to Identify the Path..

1 solution

Why is your service code concerned about the path of the project it came from?? It shouldn't be because, when it's in production, the project won't be there.

IIRC, it would be Assembly.GetExecutingAssembly().Location. Then you just use the methods in the Path class to get the path you want from there.
 
Share this answer
 
Comments
njdcjk 8-Nov-13 4:44am    
I have to use one of my Folder which is in my Project from Service.If i use what u have suggested in my service,i will get the path location of my service.But i have to get Location of my Project.
Dave Kreskowiak 8-Nov-13 7:26am    
That information doesn't exist in your executable. There is no way it can know of the location of the project folder it came from unless you specifically put the path into the code.

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