Skip to content

Commit

Permalink
nuget conversion: detect nuget module and run install-package if avai…
Browse files Browse the repository at this point in the history
…lable re #8
  • Loading branch information
qbikez committed Mar 30, 2016
1 parent 51e7232 commit 59699bf
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/csproj/functions/conversion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,20 @@ function convert-projectReferenceToNuget {
write-verbose "found project reference to $projectname in $($proj.name)"

$result += $pr

$converted = convertto-nugetreference $pr $packagesDir
if ($converted -eq $null) { throw "failed to convert referece $pr in project $($proj.name)" }
$null = replace-reference $proj $pr $converted

write-verbose "saving modified projet $($proj.fullname)"
$null = $proj.save($proj.fullname)
return $converted
if ((get-command install-package -Module nuget) -ne $null) {
write-verbose "detected Nuget module. using Nuget/install-package: install-package -ProjectName $($proj.name) -id $($pr.Name)"
nuget\install-package -ProjectName $proj.name -id $pr.Name
return "converted with NuGet module"
}
else {
$converted = convertto-nugetreference $pr $packagesDir
if ($converted -eq $null) { throw "failed to convert referece $pr in project $($proj.name)" }
$null = replace-reference $proj $pr $converted

write-verbose "saving modified project $($proj.fullname)"
$null = $proj.save($proj.fullname)
return $converted
}
}

function convert-ReferencesToNuget {
Expand Down

0 comments on commit 59699bf

Please sign in to comment.