I have a nuspec files node that looks like this:
<files>
<file src="bin\Release\MyProject.dll" target="lib\MyProject.dll" />
</files>
I run my nuspec packing in a post compile step. And it works great from Visual Studio.
But TFS does not build “normal” It puts all the libraries and sources in a “Binaries” folder.
Is there a way I could put a variable in the <file> node to point to the Binaries folder when doing a TFS build and leave it normal when building in a Visual Studio Build?
I would rather not have to have two nuspec files (one for TFS and one for visual studio).
I solved it by making a package folder in the project for which i wanted to make a Nuget package.
There I make all the folders and unchanging files in there.
I added a post build step in the project that copies the files that just have been built into the package folder and run Nuget.exe
So it goes:
Build Project
Copy output back into Package\Lib of project
Run Nuget.exe with nuspec file in package folder
Copy result to output folder next to the rest of the output.
Nuget.exe has to be either in a fixed folder on your system and the buildserver (dirty solution) or included in your build (less dirty).