Iris Classon
Iris Classon - In Love with Code

Error: Please run 'dnu restore' to generate a new lock file

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.

I decided to take a closer look

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

Comments

Leave a comment below, or by email.
Tom Robinson
11/16/2016 6:01:03 AM
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! 
Iris Classon
11/18/2016 12:12:01 PM
Reply to: Tom Robinson
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! 


Last modified on 2016-11-12

comments powered by Disqus