Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i install / use nuget if my documents folder is on a shared drive?

I see a number of issues on the nuget forum around not being able to install if your My documents folder is on a shared drive. If I don't have the flexibility to change this (locked down policy) is there any way i can use nuget?

Here is the error i get when trying to install it from the VS Extension Manager:

The system cannot find the path specified. (Exception from HRESULT:

enter image description here

The VS log file shows:

3/23/2012 9:45:26 PM - Microsoft Visual Studio Extension Installer
3/23/2012 9:45:26 PM - -------------------------------------------
3/23/2012 9:45:26 PM - Initializing Install...
3/23/2012 9:45:26 PM - Extension Details...
3/23/2012 9:45:26 PM -  Identifier      : NuPackToolsVsix.Microsoft.67e54e40-0ae3-42c5-a949-fddf5739e7a5
3/23/2012 9:45:26 PM -  Name            : NuGet Package Manager
3/23/2012 9:45:26 PM -  Author          : Microsoft Corporation
3/23/2012 9:45:26 PM -  Version         : 1.6.21215.9133
3/23/2012 9:45:26 PM -  Description     : A collection of tools to automate the process of downloading, installing, upgrading, configuring, and removing packages from a VS Project.
3/23/2012 9:45:26 PM -  Locale          : en-US
3/23/2012 9:45:26 PM -  MoreInfoURL     : http://docs.nuget.org/
3/23/2012 9:45:26 PM -  InstalledByMSI  : False
3/23/2012 9:45:26 PM -  MinFramework    : 4.0
3/23/2012 9:45:26 PM -  MaxFramework    : 4.0
3/23/2012 9:45:26 PM - 
3/23/2012 9:45:26 PM -  Supported Visual Studio Editions : 
3/23/2012 9:45:26 PM -      Version : 10.0
3/23/2012 9:45:26 PM -          Pro
3/23/2012 9:45:26 PM -          IntegratedShell
3/23/2012 9:45:26 PM -          VWDExpress
3/23/2012 9:45:26 PM -          VPDExpress
3/23/2012 9:45:26 PM -      Version : 11.0
3/23/2012 9:45:26 PM -          Pro
3/23/2012 9:45:26 PM -          IntegratedShell
3/23/2012 9:45:26 PM -          VWDExpress
3/23/2012 9:45:26 PM -          VPDExpress
3/23/2012 9:45:26 PM - 
3/23/2012 9:45:26 PM -  Supported Isolated Shells : 
3/23/2012 9:45:26 PM - 
3/23/2012 9:45:26 PM -  References      : 
3/23/2012 9:45:26 PM - 
3/23/2012 9:45:26 PM - System.IO.DirectoryNotFoundException: The system cannot find the path specified. (Exception from HRESULT: 0x80070003)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.VisualStudio.Settings.ExternalSettingsManager.GetScopePaths(String applicationPath, String suffixOrName, Boolean isLogged, Boolean isForIsolatedApplication)
   at Microsoft.VisualStudio.Settings.ExternalSettingsManager.CreateForApplication(String applicationPath)
   at VSIXInstaller.App.GetExtensionManager(SupportedVSSKU sku)
   at VSIXInstaller.App.GetExtensionManagerForApplicableSKU(SupportedVSSKU supportedSKU, IInstallableExtension installableExtension, List`1 applicableSKUs)
   at VSIXInstaller.App.InitializeInstall()
   at VSIXInstaller.App.OnStartup(StartupEventArgs e)
like image 710
leora Avatar asked Mar 24 '12 12:03

leora


People also ask

What happens when you install a NuGet package?

NuGet creates a subfolder for each package identifier, then creates subfolders for each installed version of the package. NuGet installs package dependencies as required. This process might update package versions in the process, as described in Dependency Resolution.

Where are NuGet packages stored locally?

NuGet 3.5 and earlier uses packages-cache instead of the http-cache, which is located in %localappdata%\NuGet\Cache . By using the cache and global-packages folders, NuGet generally avoids downloading packages that already exist on the computer, improving the performance of install, update, and restore operations.

How do I install NuGet from another project?

Simply copy existing packages. config file to your new project. Include this file into the project. Then follow to Package Manager Console and execute Update-Package -reinstall command.

Is NuGet installed with Visual Studio?

Starting in Visual Studio 2017, NuGet and the NuGet Package Manager install automatically when you create any .NET-related workloads in Visual Studio. You can also install the Package Manager by selecting Individual components > Code tools > NuGet package manager in the Visual Studio Installer.


2 Answers

I was facing a similar issue and the various suggestions about CasPol and loadFromRemoteSources failed; here's what worked for me (on Windows 7 sp1):

  1. Uninstall the current NuGet extension
  2. Close Visual Studio
  3. Open up a registry editor and navigate to HKEY_CURRENT-USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\
    • The Personal key will show the shared folder as its value
  4. Amend that value to a local drive location, e.g. C:\Temp\
    • Don't close regedit as you'll be changing it back in a moment
  5. Open Visual Studio
    • it might complain about not finding certain settings, but I just clicked through the warnings
  6. Install the NuGet extension
    • at least for me, this all happened smoothly in exactly the way that wasn't happening before
  7. Quit Visual Studio
  8. Revert the Personal registry value back to its previous state
  9. Restart Visual Studio
    • ... et voilà!
like image 192
Unsliced Avatar answered Sep 28 '22 07:09

Unsliced


I don't tested this myself, but you can try to modify C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config file and include loadFromRemoteSources element:

<loadFromRemoteSources enabled="true"/>

at the location <configuration> \ <runtime>. Additionally you can try to verify that no other old version NuGet is installed. You should start Visual Studio 2010 shortcut with context menu and choose "Run as administrator" to be sure that you can uninstall it.

Additionally you can consider to add "FullTrust" to the share for the .NET

CasPol.exe -m -ag 1.2 -url file://ServerName/ShareName/* FullTrust
like image 35
Oleg Avatar answered Sep 28 '22 07:09

Oleg