这可能是一个愚蠢的问题,但是我已经在谷歌上搜索了大约15分钟。
实际上,“调试”一词并非通用,这就是Google搜索结果对我没有帮助的原因。
我正在使用Visual Studio 2012。
我有一个简单的C#代码,它想将一些输出打印到.post文件中:
string sCurrPath = Directory.GetCurrentDirectory()+"Posting_0";
TextWriter tw = new StreamWriter(sCurrPath + ".post");
tw.WriteLine("something");
tw.Close();
这是for循环的一部分,但我认为这并不重要。
我期望找到一个名为
“ Posting_0.post”
但是我得到的是一个名为
“ DebugPosting_0.post”
也许它在Visual Studio首选项中。
当我尝试在Google中寻找答案时,它会误解“调试”的上下文。
提前致谢。
最佳答案
您的Directory.GetCurrentDirectory()
将具有Documents/Visual Studio 2012/projects/yourProject/Debug
作为值,因为您当前正在调试模式下运行项目
所以您可以考虑添加
使用/Posting_0
而不是Posting_0
可以在调试文件夹中获取具有正确名称的文件。