This time, I hit a jackpot checkout my project from TFS in a new device, and realise all my dependencies all gong like they never existed, only leaving the NuGet config file proving I wasn’t day dreaming before.
This actually prevents me from using Ninject.MVC3
like I used to do in MVC 3. Even more unfortunately is that Ninject package for MVC 4 is not out yet, that why this alternative solution is used.
Therefore, I would highly recommend the following practices for the people who’d like to keep their project clean and tidy: no unnecessary package or exes checked in, but still be able to use the dependencies when the project is checked out.
Enabling package restore during build in Visual Studio options
Enable package restore in options
Enabling package restore in solution
Enable package restore in solution
And you should be able to see this
Files generated by enabling pakcage restore
But it is not the end of the story, simply because you don’t want to break the rules to check in any .dll or .exe.
Force NuGet.exe to download whenever needed
Open up NuGet.targets
, find DownloadNuGetExe
, and set the value to true
.
Configure proxy to allow download
If you are working within an enterprise network, the auto-download of ‘nuget.exe’ might not work. In which case, you will have to configure a proxy for it.
Open up NuGet.targets
again, find task DownloadNuGet
, and configure the snippet with your proxy and credentials.
Some more tips
To keep things neat and tidy, you can now delete the ‘packages’ folder, because that is the whole point of doing this, right? To remove the redundant dependency files, which saves not just space but also time checking out or cloning depends on what version control mechanism you use, instead allowing build event to retrieve them back automatically.
You can now check in the changes to TFS, and you will find your TFS build server and your check out are working again!