Nov 122016
 
 November 12, 2016  Posted by at 2:25 pm Debugging, Dev Environment  Add comments

dnu-restore

Well thank you for that helpful message Mr restore Nuget packages. I had done a pull and tried to build the solution which in turn tries to restore the packages. That failed and I was prompted to do it manually.

dnu-restore2

That certainly didn’t work, but I tried a few more times before I reminded myself of the saying “The definition on insanity is trying the same thing over and over again expecting a different result”. I pulled up procmon, my most beloved Windows tool, and took a look at the fun that yielded this error after I tried the suggested restore:

 

Error        NU1006        Dependencies in project.json were modified. Please run “dnu restore” to generate a new lock file.        SpamBlocker        c:\users\something\documents\visual studio 2015\Projects\projectX\src\ProjectX\project.lock.json        1        

I added a filter on dnu.exe after seeing  a lot of activity from that process, and then took a look at the first activity that involved the json.dat file.

dnu-restore3

I decided to take a closer look

dnu-restore4

I then decided to run exactly that call manually:

“C:\Users\[user]\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\dnx.exe” “C:\Users\[user]\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\lib\Microsoft.Dnx.Tooling\Microsoft.Dnx.Tooling.dll” restore “c:\users\[user]\documents\[projectsrc]” -f “C:\Program Files (x86)\Microsoft Web Tools\DNU”

And look at that, on the next attempted restore all was good. YAY!

You can read more about the dnu.exe here – and the different arguments you can pass in

  2 Responses to “Error: Please run “dnu restore” to generate a new lock file”

  1. That’s quite an old version since DNX has been replaced by .NET Core CLI? https://docs.microsoft.com/en-us/dotnet/articles/core/migrating-from-dnx

    Anyway, I get the same thing with the latest tooling. Running “dotnet restore” at the command prompt or PowerShell prompt usually works and is easier to remember and type. Hope that helps!

    • Used to be a few updates behind on my work machine so it might be it. Installing 2017 now (what can possibly go wrong?). Thanks for the tip!

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

What is 4 + 9 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)