Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Could not find 'Cargo.toml' in 'C:\Users\...\Documents' #406

Closed
Tape-Worm opened this issue Aug 23, 2018 · 4 comments
Closed

Could not find 'Cargo.toml' in 'C:\Users\...\Documents' #406

Tape-Worm opened this issue Aug 23, 2018 · 4 comments
Labels

Comments

@Tape-Worm
Copy link

Tape-Worm commented Aug 23, 2018

I decided to play around with Rust last night (never used it before). So I got everything set up:

  • Rustup
  • RLS
  • VisualStudio Code (1.26.1)
  • This plug in/extension

I'm able to debug and run my application fine, but when I try to check or build the application I get this:
image

I have no idea why this is happening. I haven't done anything special... at least I don't think. Not sure if this is your issue or vscode. But I figured I'd try here first.

Here's my project setup:
image
For reference, the project is located at "D:\Code\RustTest"

It should be able to find the Cargo.toml right?

@nrc nrc added the bug label Aug 25, 2018
@nrc
Copy link
Member

nrc commented Aug 25, 2018

Was D:\Code\RustTest the directory you opened in VSCode? And is that the directory with Cargo.toml in it?

It looks like something (Cargo, probably) is looking for Cargo.toml in your documents directory, I'm not sure why.

@Tape-Worm
Copy link
Author

Sorry for the delay, but the answer to your questions is: Yes and yes.

@mrdrbob
Copy link

mrdrbob commented Nov 22, 2018

I was having the same problem. In my case, the issue was in my Powershell profile, where I had a line that set the current path (so when I open Powershell, it opens in a more convenient directory). VSCode apparently runs your profile script when it opens a terminal, which explains why it couldn't find the Cargo.toml file. When I removed the Set-Location ... line from my Microsoft.PowerShell_profile.ps1 file, the build commands started working.

@Tape-Worm
Copy link
Author

Tape-Worm commented Mar 26, 2019

Thanks for the help.

I had totally forgotten about this until a coworker and I were talking about Rust. And I went back to see if my profile script had a directory change in it, and sure enough, it did.

Removing that fixed it.

Question is, is this a vs code problem? or a problem with the plug in?

Anyway, it works now, so I guess this can be closed.

@Xanewok Xanewok closed this as completed Apr 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants