Jul 9, 2015 at 6:34 PM
Edited Jul 9, 2015 at 6:36 PM
Hello, I have a simple 1 project solution I am trying to package up with Nugetter. I have added a pre package powershell script based on the one provided in the documentation. I added a line to check whether any files exist in the drop folder (and also
tried checking the $tfsBinariesFolder), but it is always returning false. In addition, the copy doesn't copy anything (assuming because there are no files to copy). So I end up with a NuGet package that is effectively empty.
I have been scouring the internet to find an answer, but am stuck. Is there something I'm missing? Below is my script:
$tfsNuGetPrePackageFolder = "pre-package"
# Calculate where the files will be copied for the NuGet Packaging process
$nugetPrePackageFolder = $tfsNuGetPrePackageFolder
$nugetPrePackageFolder = Join-Path $tfsDropFolder $tfsNuGetPrePackageFolder
# for some reason $nugetPrePackageFolder is ALWAYS string.Empty here...
$logStr = "NuGet PrePackage Folder is $nuetPrePackageFolder"
# Create some variables that will be used to create the package structure
$libFolder = "lib"
$net45 = "net45"
# Function to create a subfolder with some error checking and validation
Param([string]$rootPath = $(throw "$rootPath required."), [string]$subFolder)
$folderToCreate = $rootPath
$folderToCreate = Join-Path $rootPath $subFolder
$folderStr = New-Item $folderToCreate -ItemType directory
"`n`nCreated Folder $folderStr"
# Structure to Create:
# \ lib
# \ net45
$logStr += Create-FrameworkFolder -rootPath $nugetPrePackageFolder
$logStr += Create-FrameworkFolder -rootPath $nugetPrePackageFolder -subFolder $libFolder
$prePackageLibFolder = Join-Path $nugetPrePackageFolder $libFolder
$logStr += Create-FrameworkFolder -rootPath $prePackageLibFolder -subFolder $net45
# Identify the source location(s) for the files that were built as part of the
# TFS Build Process
$net45Folder = Join-Path $tfsBinariesFolder "MySolutionFolder"
# check to see if the dlls are present
$logStr += "`n`nchecking binaries folder for DLLS `n$net45Folder `n"
$hasFiles = Test-Path "$net45Folder\*.dll"
$logStr += $hasFiles
# Copy all the files into position so NuGet can do the packaging
$dest = Join-Path $prePackageLibFolder $net45
$copiedStr = Copy-Item "$net45Folder\MyAssembly.dll" -Destination $dest -Force -PassThru
$logStr += "`n`nCopied DLLs from $net45Folder to $dest..."
$logStr += "`n`n$copiedStr"
# not sure what the activity is doing, but this is the only way I found to get output to the build log
Also, the reason I am using v1.2 is because we are still on TFS 2010