Q:

NuGet / MSBuild not copying binaries to local output folder without HintPath

I have edited Global nuget.config to use a single package folder. 
I have a new blank C# console project created by VS2015.  I add a NuGet reference, for example Newtonsoft. Json, then VS creates a packages.config and lists Newtonsoft. Json as a package.  
This gets added to the .csproj file. 
<Reference Include="Newtonsoft. Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
  <HintPath>..\..\..\CxCache\Newtonsoft. Json.9.0.1\lib\net45\Newtonsoft. Json.dll</HintPath>
  <Private>True</Private>
</Reference>

When building the project, Newtonsoft. Json binaries are copied into local bin folder.  If I delete the Newtonsoft. Json dll from local bin, it will be recopied after a build. 
However I don't want to use HintPath property in csproj (don't want to check into repo) so I figure, I should be able to delete HintPath and it'll work fine.  I remove the HintPath line from .csproj and delete Newtonsoft. Json dll from local bin. 
This time upon build, Newtonsoft. Json binaries from global nuget package folder is not copied to local bin.  Is there a work around? 

A:

Bin folder (TargetDir) - the folder to which you build, should not be part of your source control.  You NEED HintPath because without it, IDE will first check GAC, and then it will check TargetDir, and then it will check ... it may find Newtonsoft dll of completely different version somewhere on your drive, the wrong file.  
You need to correct the setup you have - do not check in any bin folders into source control, ever.  You should have branch structure and have packages folder under your branch and all solutions in your branch can work with it.  You can check in your entire packages folder so that solution doesn't need to download every time - this is ok.  But never check in output.  See - HintPath can contain relative path so that you go with your structure anywhere you want.  Tomorrow you can move your branch into different location in source control and your relative path will remain valid.  Definitely - you need HintPath 

