这code工作在一个正常的项目。
This code works in a normal project.
string path = @"...My_App_DataSample.xml";
Using(FileStream fs = File.Open(path,FileMode.Open, FileAccess.Read, FileShare.Read))
{
}
但是,当我把同样的code变成了一种方法,一个类库,然后调用方法,我收到UnAuthorizedAccessException。 注:sample.xml的是在解决方案资源管理My_App_Data文件夹
But, when i put the same code into a method in a class library and then call the method, i am getting UnAuthorizedAccessException. NOTE: The Sample.xml is in a My_App_Data folder in the solution explorer.
即使我打开VS.net管理员权限,我得到了同样的错误。
Even if i open the VS.net with admin rights, i get the same error.
任何人都可以解决这个问题。请帮助..
Can anyone resolve this. Please help..
推荐答案
这是在bin / debug文件夹中运行,所以你需要找到相对的路径。
This is running in the bin/debug folder so you need to find the path relative to that.
如果您在根目录的解决方案做了一个文件夹,它会(可能)是:
If you made a folder in your root solution it would (possibly) be:
@.. .. .. My_App_Data sample.xml的
基本上.. 从调试从斌从项目文件夹 My_App_Data sample.xml中
Basically.. up from debug up from bin up from project folder My_App_DataSample.xml
我也逃过了
相关推荐
最新文章