Is there a way to automatically update nuget.exe in the .nuget folder when using package restore?
Solution 1:
I would suggest updating .nuget\nuget.exe with this command from the command line:
nuget.exe update -self
[EDIT] : Close VS Solution first. If there's an update and the solution is opened, nuget.exe will be removed from the solution.
You could automatically update nuget.exe on restore by modifying the .nuget\nuget.targets to add the above command. I'd look at the restore command in there as an example. But I'm not sure if it's worth it, nuget.exe updates aren't that common, and backward compatibility should break very rarely.
Solution 2:
I've found the best way to handle this is by simply deleting the .nuget folder and re-enabling solution wide package restore. As said above, you could add a self update command to your build, but that will not update the targets or config files if there are changes between versions (or remove the reference from your solution). Perhaps its not that big of a deal, but this is the sure fire way to make sure you have the latest exe and configuration files. And at the end of the day, updating is only an issue if you need access to a new command or there is eventually a breaking change in a new release.