Permalink
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (33 sloc) 1.04 KB
function Resolve-ProjectName {
param(
[parameter(ValueFromPipelineByPropertyName = $true)]
[string[]]$ProjectName
)
if($ProjectName) {
$projects = Get-Project $ProjectName
}
else {
# All projects by default
$projects = Get-Project
}
$projects
}
function Get-MSBuildProject {
param(
[parameter(ValueFromPipelineByPropertyName = $true)]
[string[]]$ProjectName
)
Process {
(Resolve-ProjectName $ProjectName) | % {
$path = $_.FullName
@([Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($path))[0]
}
}
}
$project = Get-Project
$buildProject = Get-MSBuildProject
$target = $buildProject.Xml.AddTarget("Bundle")
$target.AfterTargets = "Build"
$task = $target.AddTask("Exec")
$task.SetParameter("Command", '"$(msbuildtoolspath)\msbuild.exe" $(ProjectDirectory)cassette.targets /p:OutputPath=$(OutputPath) /t:Bundle /nr:false')
$project.Save()