问题描述
我有一个包含project1和project2两个项目的解决方案。默认项目是project1。在project1里面我写了一些位于Release \App_Data \ test.xml目录下的xml文件。
我可以使用Environment.CurrentDirectory + @\ App_Data轻松访问project1中的文件\ test.xml
现在我需要访问project2中的上述文件(已更新)。任何人都可以建议我如何实现这个目标吗?
xml文件定期从project1更新,所以我需要始终访问更新的副本。
I have a solution with two projects as project1 and project2. Default project is project1. Inside project1 i have write some xml files located in a directory inside Release\App_Data\test.xml
I can easily access the file inside project1 by using "Environment.CurrentDirectory + @"\App_Data\test.xml"
Now i need to access the above file (updated) inside project2. Can anyone suggest me how to achieve this?
The xml file is updated regularly from project1, so i need to access the updated copy always.
推荐答案
string Path = Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName+@"\Project2\App_Data\test.xml;
这篇关于在同一解决方案中访问Project2中Project1的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!