Skip to content

Commit c66d709

Browse files
committed
Create MSTSCLib.dll and AxMSTSCLib.dll with pre-build event command line
1 parent ef16ac6 commit c66d709

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
param(
2+
[Parameter(
3+
Position=0,
4+
Mandatory=$true)]
5+
[String]$OutPath
6+
)
7+
8+
# Test if files are already there...
9+
if((Test-Path -Path "$OutPath\MSTSCLib.dll") -and (Test-Path -Path "$OutPath\AxMSTSCLib.dll"))
10+
{
11+
Write-Host "MSTSCLib.dll and AxMSTSCLib.dll already created!"
12+
13+
exit 0
14+
}
15+
16+
# x86 or x64
17+
$ProgramFiles_Path = ${Env:ProgramFiles(x86)}
18+
19+
if([String]::IsNullOrEmpty($ProgramFiles_Path))
20+
{
21+
$ProgramFiles_Path = $Env:ProgramFiles
22+
}
23+
24+
# Get aximp from sdk
25+
$files = (Get-ChildItem -Path "$ProgramFiles_Path\Microsoft SDKs\Windows" -Recurse -Filter "aximp.exe" -File)
26+
27+
if($files.Count -eq 0)
28+
{
29+
Write-Host "Aximp.exe not found on this system!"
30+
exit 2
31+
}
32+
33+
# Change location
34+
Write-Host "Change location to: $OutPath"
35+
Set-Location -Path $OutPath
36+
37+
# Create MSTSCLib.dll and AxMSTSCLib.dll
38+
Write-Host "Creating MSTSCLib.dll and AxMSTSCLib.dll ..."
39+
Start-Process -FilePath $files[$files.Length -1].FullName -ArgumentList "$($Env:windir)\system32\mstscax.dll" -Wait -NoNewWindow

Source/NETworkManager/NETworkManager.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
<Reference Include="WindowsBase" />
9191
<Reference Include="PresentationCore" />
9292
<Reference Include="PresentationFramework" />
93+
<Reference Include="WindowsFormsIntegration" />
9394
</ItemGroup>
9495
<ItemGroup>
9596
<ApplicationDefinition Include="App.xaml">
@@ -698,6 +699,9 @@
698699
</None>
699700
</ItemGroup>
700701
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
702+
<PropertyGroup>
703+
<PreBuildEvent>PowerShell.exe -ExecutionPolicy Bypass -NoProfile -File $(ProjectDir)..\..\Scripts\PreBuildEventCommandLine.ps1 $(TargetDir)</PreBuildEvent>
704+
</PropertyGroup>
701705
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
702706
Other similar extension points exist, see Microsoft.Common.targets.
703707
<Target Name="BeforeBuild">

0 commit comments

Comments
 (0)