-
Notifications
You must be signed in to change notification settings - Fork 30
/
Invoke-BuildSharpire.ps1
51 lines (42 loc) · 1.44 KB
/
Invoke-BuildSharpire.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function Invoke-BuildSharpire
{
[cmdletbinding()]
param
(
[ValidateSet('2.0','3.5','4.0')]
[string]
$DotNetVersion = '4.0',
[string]
$SharpireFolderPath = $pwd,
[Parameter(Mandatory)]
[ValidateSet("CommandLineSettings","CompileTimeSettings","CompileTimeSettings_Testing")]
[string]
$Configuration,
[ValidateSet("AnyCPU","x86","x64")]
[string]
$Platform = "AnyCPU"
)
$RegPath = switch ($DotNetVersion)
{
'2.0' {"HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\2.0"}
'3.5' {"HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\3.5"}
'4.0' {"HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0"}
}
Write-Verbose $RegPath
$MSBuildPath = (Get-ItemProperty -Path $RegPath).MSBuildToolsPath + "\msbuild.exe";
Write-Verbose $MSBuildPath
$SharpireFolderPath = $SharpireFolderPath + "\Sharpire.csproj"
Write-Verbose $SharpireFolderPath
$Platform2 = ""
if (-not [String]::IsNullOrEmpty($Platform))
{
$Platform2 = "/p:Platform=" + $Platform
}
$Configuration2 = ""
if (-not [String]::IsNullOrEmpty($Configuration))
{
$Configuration2 = "/p:Configuration=" + $Configuration
}
Write-Verbose "`& `"$MSBuildPath`" `"$SharpireFolderPath`" `"$Platform2`" `"$Configuration2`""
& "$MSBuildPath" "$SharpireFolderPath" "$Platform2" "$Configuration2"
}