diff options
Diffstat (limited to 'packages/Microsoft.Bcl.Build.1.0.8/tools/Install.ps1')
-rw-r--r-- | packages/Microsoft.Bcl.Build.1.0.8/tools/Install.ps1 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/Microsoft.Bcl.Build.1.0.8/tools/Install.ps1 b/packages/Microsoft.Bcl.Build.1.0.8/tools/Install.ps1 new file mode 100644 index 0000000..bafe46e --- /dev/null +++ b/packages/Microsoft.Bcl.Build.1.0.8/tools/Install.ps1 @@ -0,0 +1,18 @@ +param($installPath, $toolsPath, $package, $project) + # This is the MSBuild targets file to add + $targetsFile = [System.IO.Path]::Combine($toolsPath, $package.Id + '.targets') + + # Need to load MSBuild assembly if it's not loaded yet. + Add-Type -AssemblyName 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' + + # Grab the loaded MSBuild project for the project + $msbuild = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($project.FullName) | Select-Object -First 1 + + # Make the path to the targets file relative. + $projectUri = new-object Uri($project.FullName, [System.UriKind]::Absolute) + $targetUri = new-object Uri($targetsFile, [System.UriKind]::Absolute) + $relativePath = [System.Uri]::UnescapeDataString($projectUri.MakeRelativeUri($targetUri).ToString()).Replace([System.IO.Path]::AltDirectorySeparatorChar, [System.IO.Path]::DirectorySeparatorChar) + + # Add the import and save the project + $msbuild.Xml.AddImport($relativePath) | out-null + $project.Save()
\ No newline at end of file |