作者hoyunxian (WildDagger)
看板C_Sharp
标题Re: [问题] ms-appx:/// 档案一直找不到
时间Sun May 31 20:04:03 2015
※ 引述《nature23306 (pART)》之铭言:
: 刚开始写Windows市集的app
: 用VS创一个Grid App的页面
: Grid的资料读取是"SampleData.json"中的资料
: 读取的Code长这样
: Uri dataUri = new Uri("ms-appx:///DataModel/SampleData.json");
: 我有一个Example.json要读取
: 程式码改成
: Uri dataUri = new Uri("ms-appx:///DataModel/Example.json");
: 但却一直显示出现错误
: The system cannot find the file specified.
: 整个程式码我只有改这一部分
: 应该是档案找不到的关系
: 请问要怎麽做??
这里有个很大的陷阱。
请检查一下你用来替换SampleData.json的档案编译选项是否有设为「内容」。
如果没有,那麽编译时系统会把你的档案当空气略掉,
自然程式就找不到你的档案了(因为就真的没放在执行目录下)
--
Sent from my Windows Phone
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 42.70.248.23
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_Sharp/M.1433073846.A.AD0.html
※ 编辑: hoyunxian (111.250.44.101), 05/31/2015 21:46:48