无法在 VS Code 终端中创建 C# 控制台应用程序

Lui*_*uis 5 c# visual-studio-code

当我尝试在 VScode 中创建新的 C# 项目时,出现错误。我该如何修复它?

\n\n

这是我的命令:

\n\n

PS C:\\Users\\lau\\Documents\\code\\c#> dotnet new console

\n\n

这是错误消息\xef\xbc\x9a

\n\n
\n

无法创建模板“控制台应用程序”。\n 处理文件时出错\n /content/ConsoleApplication-CSharp/Company.ConsoleApplication1.csproj\n System.IO.FileNotFoundException: 找不到文件\n \'C:\\Users\\lau\\Documents\\code \\c#\\c#.csproj\'。文件名:\n \'C:\\Users\\lau\\Documents\\code\\c#\\c#.csproj\' at\n System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)\n at System. IO.FileStream.CreateFileOpenHandle(FileMode 模式、FileShare\n 共享、FileOptions 选项)at\n System.IO.FileStream..ctor(字符串路径、FileMode 模式、FileAccess\n 访问、FileShare 共享、Int32 bufferSize、FileOptions 选项)\ n at System.IO.FileStream..ctor(字符串路径、FileMode 模式、FileAccess\n 访问、FileShare 共享、Int32 bufferSize)at\n System.IO.File.Create(字符串路径)at\n Microsoft.TemplateEngine.Utils .PhysicalFileSystem.CreateFile(String\n 路径) at\n Microsoft.TemplateEngine.Core.Util.Orchestrator.ProcessFile(IFile\n sourceFile, String sourceRel, String targetDir, IGlobalRunSpec 规范,\n IProcessor 后备, IEnumerable 1 fileGlobProcessors, IReadOnlyList1\n locOperations)

\n
\n

小智 1

我遇到了同样的问题,并修复了它再次创建目录root或在 中创建目录C:\,问题是与目录关联的权限