On my local computer I created the network drive D:/ that points to \\MyComputerName\D.
On my local disk C:/ I created a folder with the name D and configured a network share with permission to everyone on that share.
Then I start Windows PowerShell ISE. My working directory is C:\Users\username
After that I create a folder with Powershell within this network drive such as
[System.IO.Directory]::CreateDirectory("D:/Foo/Bar")
the directory Foo with his subfolder Bar will be created successfully.
Then I remove the Foo folder within D:/ and start Visual Studio 2019 with Admin Permissions.
Then I create a simple C#.NET Console Application such as
class Program
{
static void Main(string[] args)
{
System.IO.Directory.CreateDirectory(@"D:/Foo/Bar");
}
}
If I run the Console Application the directory will not be created and I get System.IO.DirectoryNotFoundException: 'Could not find a part of the path 'D:\Foo\Bar'.'
What should I do to create successfully the folder with my simple console application?