I decided to play around with Rust last night (never used it before). So I got everything set up:
I'm able to debug and run my application fine, but when I try to check or build the application I get this:
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:
For reference, the project is located at "D:\Code\RustTest\"
It should be able to find the Cargo.toml right?
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.
Sorry for the delay, but the answer to your questions is: Yes and yes.
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.
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.
Most helpful comment
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 myMicrosoft.PowerShell_profile.ps1
file, the build commands started working.