Reputation: 163
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"
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 have I made any significant code/settings modification since the last time it ran successfully. I'm working on Visual Studio 2013 with TFS. Can 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
Unable to copy a file from obj\Debug to bin\Debug
Upvotes: 2
Views: 20815
Reputation: 163
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). not the most elegant solution, but it worked for me.
Upvotes: 0
Reputation: 1691
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". I observed that it happens during the rebuild process, when Visual Studio cleans up the old compile. 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
Upvotes: 2