StreamWriter を使用して、作成したファイルを保存する場所を指定しようとしています。
string getCurrentPath = Environment.CurrentDirectory;
StreamWriter writeFile = new StreamWriter(@"" +getCurrentPath + "\\NDependProject\\OceanAPIDependencies.xml");
writeFile.Close();
次のエラー メッセージが表示されます。
Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Project_Summer\ExtensionDirectoryTraversal\ExtensionDirectoryTr aversal\bin\Debug\NDependProject\OceanAPIDependencies.xml'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, I nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions o ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolea n useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean che ckHost) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encodin g, Int32 bufferSize, Boolean checkHost) at System.IO.StreamWriter..ctor(String path) at ExtensionDirectoryTraversal.Program.Main(String[] args) in d:\Project_Summ er\ExtensionDirectoryTraversal\ExtensionDirectoryTraversal\Program.cs:line
15 任意のキーを押して続行します。. .