[英]"Could not find file...\bin\Debug" error when trying to run project at debug mode
I know it's a relatively frequent asked question, but none of the solutions that had been offered works for me, so as a last resort, I am raising it again:我知道这是一个相对常见的问题,但提供的解决方案都不适合我,所以作为最后的手段,我再次提出:
suddenly, when trying to run my project at debug mode, I'm getting errors:突然,当我尝试在调试模式下运行我的项目时,出现错误:
"Can not load NameOfFIleHere.xml file - Could not find file 'c:\\Users\\FullLocationHere\\bin\\Debug\\NameOfFIleHere.xml'" and "Can not load 'c:\\Users\\FullLocationHere\\bin\\Debug\\NameOfFIleHere.xml' - Configuration system failed to initialize"
“无法加载 NameOfFIleHere.xml 文件 - 找不到文件 'c:\\Users\\FullLocationHere\\bin\\Debug\\NameOfFIleHere.xml'”和“无法加载 'c:\\Users\\FullLocationHere\\bin\\Debug\\NameOfFIleHere.xml” ' - 配置系统初始化失败”
I'm working on this project for a while now and never had any similar problem.我现在在这个项目上工作了一段时间,从来没有遇到过类似的问题。 in addition, I haven't changed any of my xml files lately nor did I made any major code/settings modification since the last time it run successfully.
此外,自从上次成功运行以来,我最近没有更改任何 xml 文件,也没有进行任何主要的代码/设置修改。 I'm working on Visual Studio 2013 with TFS.
我正在使用 TFS 处理 Visual Studio 2013。 May anyone please offer me some ideas as to why it keeps happening?
任何人都可以请给我一些关于为什么它不断发生的想法吗?
Thanks a lot!非常感谢!
Some of the solutions I've tried:我尝试过的一些解决方案:
Unable to copy file, Access to the path is denied 无法复制文件,拒绝访问路径
Could not find file ..\\bin\\Debug\\content.dat 找不到文件 ..\\bin\\Debug\\content.dat
Unable to copy a file from obj\\Debug to bin\\Debug 无法将文件从 obj\\Debug 复制到 bin\\Debug
When working with content-files (xml, images, etc..) that come from another project than the GUI/Starting-Project it can sometimes happen, that the file cannot be written in the GUI/Starting-Project's bin\\debug even if it's set to "copy always".当使用来自另一个项目而不是 GUI/Starting-Project 的内容文件(xml、图像等)时,有时会发生该文件无法写入 GUI/Starting-Project 的 bin\\debug,即使它设置为“始终复制”。 I observed that it happens during the rebuild process, when Visual Studio cleans up the old compile.
我观察到它发生在重建过程中,当 Visual Studio 清理旧编译时。 Fairly randomly, it seems that a file-handle gets stuck and prevents the files to be created.
相当随机,似乎文件句柄卡住并阻止创建文件。
Personally I solved the problem by copying needed application files to我个人通过将所需的应用程序文件复制到
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
"CompanyName", "AppName")
which resolves to:其解析为:
C:\ProgramData\CompanyName\AppName
Just an update as to how it was solved: I've ended up deleting the project from tfs and uploaded an older copy of it from another folder (which is located directly under C:, as was recommended to me above).只是关于它如何解决的更新:我最终从 tfs 中删除了该项目,并从另一个文件夹(直接位于 C: 下,正如上面向我推荐的那样)上传了它的旧副本。 not the most elegant solution, but it worked for me.
不是最优雅的解决方案,但它对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.