"Could not find file...\bin\Debug" 在调试模式下尝试 运行 项目时出错

"Could not find file...\bin\Debug" error when trying to run project at debug mode

我知道这是一个相对常见的问题,但是 none 提供的解决方案对我有用,所以作为最后的手段,我再次提出它:

突然,在调试模式下尝试 运行 我的项目时,出现错误:

"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"

我在这个项目上工作了一段时间,从来没有遇到过类似的问题。此外,我最近没有更改我的任何 xml 文件,自上次 运行 成功以来我也没有进行任何重要的 code/settings 修改。 我正在使用 TFS 开发 Visual Studio 2013。 谁能给我一些关于为什么会发生这种情况的想法?

非常感谢!

我尝试过的一些解决方案:

Unable to copy file - access to the path is denied

Could not find file ..\bin\Debug\content.dat

Unable to copy a file from obj\Debug to bin\Debug

当处理来自另一个项目而不是 GUI/Starting-Project 的内容文件(xml、图像等..)时,有时会发生文件无法写入 GUI/Starting-Project 的 bin\debug 即使它设置为 "copy always"。我观察到它发生在重建过程中,当 Visual Studio 清理旧编译时。相当随机地,似乎文件句柄被卡住并阻止创建文件。

我个人通过将所需的应用程序文件复制到

解决了这个问题
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
"CompanyName", "AppName")

解析为:

C:\ProgramData\CompanyName\AppName

只是关于如何解决的更新: 我最终从 tfs 中删除了该项目,并从另一个文件夹(直接位于 C: 下,正如上面向我推荐的那样)上传了它的旧副本。不是最优雅的解决方案,但它对我有用。