user17570160
user17570160

Reputation:

Why am I getting the error: An error occurred while trying to create a file in the destination directory

I don't know why I am getting this error suddenly whilst using vs code. Please help me, Thanks in advance.

P.S(I don't think files can be created in an exe right? I'm not sure after seeing this. Maybe do I have to specify where the file should be created and if yes, please tell me how. Else I'm looking for another answer)

(Edit): I tried downloading the system installation instead of the user installation. The system installer installs for all users on the system and needs administrator privileges unlike the user installer which install vs code only the particular user installing it.

Thanks, Codestrip

error

Upvotes: 2

Views: 19385

Answers (4)

R2N
R2N

Reputation: 11

I had the same issue. But I fixed it. just go to this link and add take ownership to your context menu. https://www.tenforums.com/tutorials/3841-add-take-ownership-context-menu-windows-10-a.html After adding take ownership just go to vs code main directory and right-click on the Microsoft VS Code folder then press take ownership. After that your problem will be solved.

Upvotes: 1

Uniquedesign
Uniquedesign

Reputation: 453

If you run your "vscode" as admin then you won't see this error anymore.

  1. Go to your "vscode" install location
  • If not sure then open the start menu.
  • Write vscode.
  • Right click on the icon and click "Open File Location".
  • In a new window there will be again an icon for the "vscode" right click on the icon
  • Again and click "open file location".
  • In another window, there will be an actual vscode's "exe" file.
  1. Right-click on this file and go to the "send" > "send on desktop" option.
  2. On the Desktop right-click on the icon and go to the properties
  3. Click on Advance Option and Check the "Run as Admin" Option
  4. Click Apply and Ok.
  5. Now if you want Right Click on this icon again and select "pin to taskbar".

Hopefully, you won't see this error again.

Upvotes: 3

NinjaDQ
NinjaDQ

Reputation: 83

I also encountered this error. I tried remove the folder Microsoft VS Code inside C:\Users\<your username>\AppData\Local\Programs, and problem seems resloved

Upvotes: 0

mihai ciufudean
mihai ciufudean

Reputation: 68

my solution for this was to set it to always start as administrator, I don't feel like reinstalling vscode (newly installed) It's not a great solution for those who have multiple users, but I got rid of the error.

Ah, I saw that was a problem within User Permission, there were only 2 options checked. https://prnt.sc/uV-bF_q52Y3Y

I hope my solution will help you.

Upvotes: 4

Related Questions