msbuild .targets files that copies package content (path to package contain version)

Topics: General
Mar 12, 2013 at 6:33 PM

I currently moving a customer from keeping his binaries in source control to use NuGet instead.
As for the "regular" use, all works well.
Compiling is solutions I have found out that he uses post build events and msbuild .targets files to copy binaries from one folder to another.
I have started switching the old paths that had been saved in the source control to the new paths of the $(solutionDir)packages folder.
Problem is that under the packages folder there are folder/s in the format of:
<package id>.<package version>.
What will happen when the package will be updated? The copy command will fail (or at least will not copy the latest version).
How can I deal with that?

Mar 12, 2013 at 11:49 PM
Hi Gil,

Could you run NuGet.exe from your command line? If you do, you can use the List command to find out the current version of any package. Try the following:
    NuGet.exe List id:Newtonsoft.Json
I should also point out that if the package is installed and the project has been built, then the assemblies are likely already in the project folder itself. That location may prove to be less prone to change over time for the reason you've noted.

Mar 13, 2013 at 4:33 PM
Hi ClayCompton,

I had a short conversation with one of my colleagues and we have decided not to copy these files till we'll understand what are these copies for.
Your solution is reasonable and I thought of other workarounds as well but they were not what I was looking for.

Thanks for now
Mar 17, 2013 at 8:54 AM
Edited Mar 17, 2013 at 8:55 AM
Mar 17, 2013 at 8:54 AM
Edited Mar 17, 2013 at 8:55 AM