Unable to create a C# console application in VS Code terminal

Viewed 931

When I try to create a new C# project in VScode,I got aerror. How can I fix it?

This is my command:

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

And this is the error message:

Template "Console Application" could not be created. Error while processing file /content/ConsoleApplication-CSharp/Company.ConsoleApplication1.csproj System.IO.FileNotFoundException: Could not find file 'C:\Users\lau\Documents\code\c#\c#.csproj'. File name: 'C:\Users\lau\Documents\code\c#\c#.csproj' at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle) at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) at System.IO.File.Create(String path) at Microsoft.TemplateEngine.Utils.PhysicalFileSystem.CreateFile(String path) at Microsoft.TemplateEngine.Core.Util.Orchestrator.ProcessFile(IFile sourceFile, String sourceRel, String targetDir, IGlobalRunSpec spec, IProcessor fallback, IEnumerable1 fileGlobProcessors, IReadOnlyList1 locOperations)

2 Answers

I had same problem, I fixed mine by opening the command prompt console as an administrator

I had same problem, and fixed it creating directory again from root or creating directory in C:\, the problem is permissions associated to directory

Related