PistonDevelopers / VisualRust

Visual Studio extension for Rust
MIT License
701 stars 73 forks source link

No Rust installation detected (rustup-init.exe, VisualRust 0.1.2, VS 2015) #263

Open Byron-Miles opened 7 years ago

Byron-Miles commented 7 years ago

This is similar to previous issues and seems to be fixed in the lastest (but not released as of 3 Jan 2017) code, but considering it took me over 2 hours and some digging through old (VisualRust 0.1.2) code to work out a straight answer I thought I might save someone time and post the solution here:

Basically you need to point VisualRust at your install (.cargo) directory using a registry key:

  1. Run regedit.exe
  2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE
  3. Create a 'Mozilla Foundation' key (assuming it doesn't exist) under the 'SOFTWARE' key
  4. Create a 'Rust' key under the 'Mozilla Foundation' key (note: technically it only needs to start with 'rust', so you can use something like 'Rust Stable' if you like)
  5. Create another key under the 'Rust' key; pretty sure the name doesn't matter, so your installed rustc.exe version is a good choice (e.g. '1.14.0'). Your full registry path should look something like: HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla Foundation\Rust\1.14.0
  6. Create an 'InstallDir' String Value under that key with the value being the install path (e.g. C:\Users\User\.cargo\ )

Good luck.

tyoc213 commented 7 years ago

When will be published? This plugin suport rustup? (I mean if I change global version or per project/dir)??

jujis008 commented 7 years ago

Works for me with above solution, thanks a lot. But how did the VR fixed the dependency problem? Any idea is welcome for such a greenhand like me.

holland01 commented 7 years ago

@Byron-Miles

Were you running the 64-bit install when you tried this?

Xanewok commented 7 years ago

@holland01 Not sure about @Byron-Miles, but I think I did. Running Windows 10 64 bit.

And I encountered the same problem as OP (registry key fix also helped - no error and VS properly compiles the project).

huettenhain commented 7 years ago

Same as @Xanewok here. Since I have to fix this on more than one machine, I translated @Byron-Miles solution to a console command (admin required). Works as long as you used the default rustup installation path:

REG ADD "HKLM\SOFTWARE\Mozilla Foundation\Rust\current" /v InstallDir /t REG_SZ /d "%USERPROFILE%\.cargo"
Pzixel commented 7 years ago

Just tried same registry fix, repaired VisualRust installation, but still getting the same error. VS2015U3, Rust 1.15.1. Path is configured, rustc is working from command prompt just fine, so completely dunno what's wrong.

Ustimov commented 7 years ago

@Pzixel, I think you made some kind of mistake or doesn't restart VS after registry edit. This works for me with Win10Pro, VS2015U3 and Rust 1.15.1.

Pzixel commented 7 years ago

@Ustimov I always restart the whole PC after registry edit. That's quite easy to say I have the same leg and it's ok but it's not an answer.

OrkanCom commented 7 years ago

For lazy persons like me; Regedit_Rust_1.16.0_InstallDir.txt

1) Just download this txt file, 2) Change your Rust Version Number ( in my case it's 1.16.0 ) and Windows's "User" name, 3) Rename it to filename.reg and run it.

Txt file contains this;

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla Foundation\Rust\1.16.0]
"InstallDir"="C:\\Users\\YOURUSERNAME\\.cargo\\"

Tested on Windows 8.1 64bit, Visual Studio 2015 Update3, Visual Rest VS Extension 0.1.2 ( No need to restart VS or OS )

dimant commented 7 years ago

bump

keerthivasan-r commented 6 years ago

Yeah, No restart required. Works fine! @huettenhain Thanks for the console command. Cheers

ShiqiAi commented 6 years ago

also works for me on 1.24.0 today

whidbey commented 4 years ago

For lazy persons like me; Regedit_Rust_1.16.0_InstallDir.txt

  1. Just download this txt file,
  2. Change your Rust Version Number ( in my case it's 1.16.0 ) and Windows's "User" name,
  3. Rename it to filename.reg and run it.

Txt file contains this;

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla Foundation\Rust\1.16.0]
"InstallDir"="C:\\Users\\YOURUSERNAME\\.cargo\\"

Tested on Windows 8.1 64bit, Visual Studio 2015 Update3, Visual Rest VS Extension 0.1.2 ( No need to restart VS or OS )

works form e