Created
October 2, 2018 09:18
-
-
Save RichieBzzzt/2dad269f526a98fa662b6b3931356361 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Install-MicrosoftDataToolsMSBuild { | |
[cmdletbinding()] | |
param ( | |
[parameter(Mandatory)] | |
[string] $WorkingFolder, | |
[string] $NuGetPath | |
) | |
Write-Verbose "Verbose Folder (with Verbose) : $WorkingFolder" | |
Write-Verbose "DataToolsVersion : $DataToolsMsBuildPackageVersion" | |
Write-Warning "If DataToolsVersion is blank latest will be used" | |
if ($PSBoundParameters.ContainsKey('NuGetPath') -eq $false) { | |
$NuGetExe = Install-NuGet -WorkingFolder $WorkingFolder | |
} | |
else { | |
Write-Verbose "Skipping Nuget download..." -Verbose | |
$NuGetExe = Join-Path $NuGetPath "nuget.exe" | |
} | |
$nugetInstallMsbuild = "&$NugetExe install Microsoft.Data.Tools.Msbuild -ExcludeVersion -OutputDirectory $WorkingFolder" | |
Write-Host $nugetInstallMsbuild -BackgroundColor White -ForegroundColor DarkGreen | |
$execNuget = Invoke-Expression $nugetInstallMsbuild 2>&1 | |
Write-Host $execNuget | |
$SSDTMSbuildFolderNet46 = "$WorkingFolder\Microsoft.Data.Tools.Msbuild\lib\net46" | |
if (-not (Test-Path $SSDTMSbuildFolderNet46)) { | |
$SSDTMSbuildFolderNet40 = "$WorkingFolder\Microsoft.Data.Tools.Msbuild\lib\net40" | |
if (-not (Test-Path $SSDTMSbuildFolderNet40)) { | |
Throw "It appears that the nuget install hasn't worked, check output above to see whats going on" | |
} | |
} | |
if (Test-Path $SSDTMSbuildFolderNet46) { | |
return $SSDTMSbuildFolderNet46 | |
} | |
elseif (Test-Path $SSDTMSbuildFolderNet40) { | |
return $SSDTMSbuildFolderNet40 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment