25

I have installed dotless via Package Manager in VS2012 in to an existing mixed C# solution (Class libraries and MVC2 apps), however now when I build it (F5) I get the following two errors:

The command ""C:\@GitRepos\EBS\SolutionFiles\.nuget\nuget.exe" install "C:\@GitRepos\EBS\\packages.config" -source "" -o "C:\@GitRepos\EBS\SolutionFiles\packages"" exited with code -1.

and

The system cannot find the path specified.

After adding dotless to the solution a ".nuget" folder with "NuGet.exe and "NuGet.targets" has been added.

I have also tried adding dotless to a new MVC2 project and other than having to add a mime type to the web.config it all works well. There isn't however a ".nuget" folder.

I also noticed that the same happens if I create a new NServiceBus solution (after installing it). The paths in the message change but the error is the same.

If I take

"C:\@GitRepos\EBS\SolutionFiles\.nuget\nuget.exe" install "C:\@GitRepos\EBS\\packages.config" -source "" -o "C:\@GitRepos\EBS\SolutionFiles\packages"

and run it via a command prompt then I get:

All packages listed in packages.config are already installed.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Canters
  • 411
  • 1
  • 4
  • 6
  • 8
    So after giving up on this and then a few days later looking in to it again, I found the answer. I came across http://david-martos.blogspot.co.uk/. After opening my command prompt and finding it also said "The system cannot find the path specified" I went looking in the registry. I found in "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" that there was an AutoRun key for "c:\ansi140\x64\ansicon.exe -p ". After deleting this and trying one of my NserviceBus solutions again I found it built fine. I hope this helps others. – Canters Jun 29 '12 at 13:38
  • 1
    You should post this one as answer, it helps me and I would never guess to look this way by myself. – vorou Jan 29 '13 at 11:11

6 Answers6

29

So after giving up on this and then a few days later looking in to it again, I found the answer. I came across david-martos.blogspot.co.uk. After opening my command prompt and finding it also said "The system cannot find the path specified" I went looking in the registry. I found in "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" that there was an AutoRun key for "c:\ansi140\x64\ansicon.exe -p ". After deleting this and trying one of my NserviceBus solutions again I found it built fine. I hope this helps others.

Here is a direct link to David Martos post.

Matas Vaitkevicius
  • 58,075
  • 31
  • 238
  • 265
Nathan McKenzie
  • 400
  • 3
  • 6
  • Thanks a lot! Ansicon is pure evil. – Emil Lundin Nov 28 '13 at 08:28
  • I'm using conemu/cmdr console emulator and it hijacked the same registry key causing me issues. – sdanna Feb 26 '14 at 21:46
  • 1
    Key bit for me that was different from the blog and pointed out above was the location of the reg key "HKEY_CURRENT_USER", the blog points you to local machine so look in both places depending on your setup. – Thomas Harris May 01 '14 at 17:22
  • I deleted ansicon because cmder was complaining and I didn't think I needed it. After two days of trying to figure this out I found this page. Thank you..... – blockloop Apr 02 '15 at 21:07
  • Yes, i have an ansicon, becouse i am installed it. But i have the same problem in VS. I deleted key AutoRun, but this not works for me =( – Vladislav Oct 29 '15 at 12:37
  • YEAH!=) Just deleting the folder .nuget (in the solution folder) and then running the application do the trick for me! Thanks for your answers! – Vladislav Oct 29 '15 at 12:44
  • Mine was in this path: "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Command Processor\" – Andrew Gee Aug 30 '16 at 09:50
8

This was also likely a nuget package restore consent that you had to set. http://blog.nuget.org/20120518/package-restore-and-consent.html

For anyone who wants to permanently have the consent accepted, take a look at installing http://nuget.org/packages/NuGetEnablePackageRestore - it will be accepted on all machines automatically.

ferventcoder
  • 11,952
  • 3
  • 57
  • 90
5

Just execute the command below from NuGet Package Manager Console. It worked for me:

PM> Install-Package NuGetEnablePackageRestore
Matthew Lock
  • 13,144
  • 12
  • 92
  • 130
Thakur Rock
  • 515
  • 5
  • 7
5

I solved this problem by opening up the Package Manager Console and clicking on the "Restore" button on the warning that popped up. Here's a pick of what it looked like. This is similar to the other solutions, but from a different angle.

enter image description here

mkimmet
  • 749
  • 3
  • 15
  • 27
  • 1
    I also had NuGet inexplicably failing. I opened "Manage NuGet packages" for a random project in the solution, clicked on the "Restore" button in the popup and then everything worked. – Dan Mirescu Jun 22 '17 at 13:00
2

I had the same error:

"The command "" exited with code -1." and "The system cannot find the path specified."

I tested all the possible solutions I found and nothing worked, at the end what I did was take the NuGet.exe from another project and replace it in the project inside the .nuget folder that was generating the error and is working now.

Byron
  • 36
  • 3
1

For me, I had accidentally deleted the NuGet.Config file from the root of my project directory. Fortunately, I could restore it with source control.

Here's the content of my file if anyone have done the same mistake as me and doesn't have a backup:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <add key="repositorypath" value="NuGet Packages" />
    <add key="globalPackagesFolder" value="NuGet Packages" />
  </config>  
  <packageRestore>
    <add key="enabled" value="True" />
  </packageRestore>  
</configuration>
IveGotThePawa
  • 45
  • 1
  • 7