forked from kunaludapi/NETworkManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPreBuildEventCommandLine.ps1
More file actions
50 lines (42 loc) · 1.47 KB
/
Copy pathPreBuildEventCommandLine.ps1
File metadata and controls
50 lines (42 loc) · 1.47 KB
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
param(
[Parameter(
Position=0,
Mandatory=$true)]
[String]$OutPath
)
# Fix wrong path
# Quotation marks are required if a blank is in the path... If there is no blank space in the path, a quote will be add to the end...
# VS prebuild event call: PowerShell.exe -ExecutionPolicy Bypass -NoProfile -File "$(ProjectDir)..\..\Scripts\PreBuildEventCommandLine.ps1" "$(TargetDir)"
if(-not($OutPath.StartsWith('"')))
{
$OutPath = $OutPath.TrimEnd('"')
}
# Test if files are already there...
if((Test-Path -Path "$OutPath\MSTSCLib.dll") -and (Test-Path -Path "$OutPath\AxMSTSCLib.dll"))
{
Write-Host "MSTSCLib.dll and AxMSTSCLib.dll already there!"
return
}
# x86 or x64
$ProgramFiles_Path = ${Env:ProgramFiles(x86)}
if([String]::IsNullOrEmpty($ProgramFiles_Path))
{
$ProgramFiles_Path = $Env:ProgramFiles
}
# Get aximp from sdk
$AximpPath = ((Get-ChildItem -Path "$ProgramFiles_Path\Microsoft SDKs\Windows" -Recurse -Filter "aximp.exe" -File) | Sort-Object FullName | Select-Object -First 1).FullName
if([String]::IsNullOrEmpty($AximpPath))
{
Write-Host "Aximp.exe not found on this system!"
return
}
else
{
Write-Host "Using aximp.exe form: $AximpPath"
}
# Change location
Write-Host "Change location to: $OutPath"
Set-Location -Path $OutPath
# Create MSTSCLib.dll and AxMSTSCLib.dll
Write-Host "Build MSTSCLib.dll and AxMSTSCLib.dll ..."
Start-Process -FilePath $AximpPath -ArgumentList "$($Env:windir)\system32\mstscax.dll" -Wait -NoNewWindow