Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Rust installation detected. You can download official Rust installer #303

Open
stiv-yakovenko opened this issue Aug 22, 2017 · 8 comments
Labels
Milestone

Comments

@stiv-yakovenko
Copy link

I've installed visual rust 0.1.2, I have rustc.exe and some other files installed here: C:\Users\steve.cargo\bin
But when I try to build rust project in msvc 2015 I get this error:

C:\Program Files (x86)\MSBuild\VisualRust\VisualRust.Rust.targets(53,5): error : No Rust installation detected. You can download official Rust installer from https://www.rust-lang.org/downloads.html

How is the installation detected? How can I fix this?

@MaulingMonkey
Copy link
Collaborator

MaulingMonkey commented Aug 31, 2017

Here is where installation paths that get checked are enumerated:

public static IEnumerable<string> GetAllInstallPaths()
{
if (System.Environment.Is64BitOperatingSystem)
{
return GetInstallRoots(RegistryHive.CurrentUser, RegistryView.Registry64)
.Union(GetInstallRoots(RegistryHive.CurrentUser, RegistryView.Registry32))
.Union(new string[] { GetMultirustInstallRoot(), GetRustupInstallRoot() })
.Union(GetInstallRoots(RegistryHive.LocalMachine, RegistryView.Registry64))
.Union(GetInstallRoots(RegistryHive.LocalMachine, RegistryView.Registry32))
.Union(GetInnoInstallRoot());
}
else
{
return GetInstallRoots(RegistryHive.CurrentUser, RegistryView.Registry32)
.Union(new string[] { GetMultirustInstallRoot(), GetRustupInstallRoot() })
.Union(GetInstallRoots(RegistryHive.LocalMachine, RegistryView.Registry32))
.Union(GetInnoInstallRoot());
}
}

static string GetRustupInstallRoot()
{
// rustup.rs installs into %CARGO_HOME%\bin\ and %CARGO_HOME% defaults to %USERPROFILE%\.cargo\
string cargoHome = System.Environment.GetEnvironmentVariable("CARGO_HOME");
if (String.IsNullOrEmpty(cargoHome))
{
string userprofile = System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile);
return Path.Combine(userprofile, ".cargo");
}
return cargoHome;
}

Might just need to set CARGO_HOME appropriately.

@dzmitry-lahoda
Copy link

Same for me with rust 1.20 on Windows 10 64bit Visual Studio 2015.

I have set CARGO_HOME to C:\Users\dzmitry_lahoda\.cargo, but still have and issues.

@MaulingMonkey
Copy link
Collaborator

Ahh, sorry, I've just noticed that the logic is different in Visual Rust 1.2.0 - it doesn't support CARGO_HOME: https://github.com/PistonDevelopers/VisualRust/blob/0.1.2/VisualRust.Shared/Environment.cs

Setting MULTIRUST_HOME to your .cargo path might work, or there are some earlier workarounds with registry keys: #263 . Alternatively, grab the trunk version from https://ci.appveyor.com/project/vosen/visualrust/build/artifacts (or follow the Readme's appveyor links).

@dzmitry-lahoda
Copy link

Latest installation for 2015

9/16/2017 4:49:56 PM - Microsoft VSIX Installer
9/16/2017 4:49:56 PM - -------------------------------------------
9/16/2017 4:49:56 PM - vsixinstaller.exe version:
9/16/2017 4:49:56 PM - 15.0.26209.1 built by: D15REL
9/16/2017 4:49:56 PM - -------------------------------------------
9/16/2017 4:49:56 PM - Command line parameters:
9/16/2017 4:49:56 PM - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe,/admin,/logFile:C:\Users\DZMITR~1\AppData\Local\Temp\Visual_Rust_for_Visual_Studio_2015_20170916164815_002_VSIXBootstrapper.log,C:\ProgramData\Package Cache\9864EE5369359DB622D0234B6C6B7640B949140C\VisualRust.vsix
9/16/2017 4:49:56 PM - -------------------------------------------
9/16/2017 4:49:56 PM - Microsoft VSIX Installer
9/16/2017 4:49:56 PM - -------------------------------------------
9/16/2017 4:49:58 PM - Initializing Install...
9/16/2017 4:49:59 PM - Microsoft.VisualStudio.ExtensionManager.InvalidExtensionPackageException: The file is not a valid VSIX package.
   at Microsoft.VisualStudio.ExtensionManager.InstallableExtensionImpl.ReadVSIXManifestFromPackage(Stream stream, CultureInfo preferredCulture)
   at Microsoft.VisualStudio.ExtensionManager.InstallableExtensionImpl..ctor(String path, CultureInfo preferredCulture)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.CreateInstallableExtension(String extensionPath, CultureInfo preferredCulture)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.CreateInstallableExtension(String extensionPath)
   at VSIXInstaller.App.GetInstallableData(String vsixPath, Boolean isRepairSupported, IEnumerable`1& skuData)
   at VSIXInstaller.App.Initialize(Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

I have installed VS 2017 Pro and latest plugin. No install errors, but no templates in New Project.

@dzmitry-lahoda
Copy link

dzmitry-lahoda commented Sep 16, 2017

MULTIRUST_HOME seems deprecated.

@MaulingMonkey
Copy link
Collaborator

There's an unmerged pull request to fix the templates and other issues: #286

@MaulingMonkey MaulingMonkey added this to the 0.2 milestone Sep 20, 2017
@lucabtz
Copy link

lucabtz commented Sep 3, 2018

Any news on this Issue, I'm having the same problem, even after setting the CARGO_HOME
Need any help fixing this?

@seechov
Copy link

seechov commented Dec 16, 2022

Solution from this bug helped me.
Solution. Create file rust-win.reg with similar content (replace TODO_Place_your_username_here to your actual path.

Windows Registry Editor Version 5.00

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

Then run it by double-clicking on the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants