mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-25 14:06:41 +01:00
Strong name the discord DLLs ourselves
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NO_STRONG_NAME</DefineConstants>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile>bin\x86\Release\TGServerService.xml</DocumentationFile>
|
||||
<Optimize>true</Optimize>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
@@ -45,13 +45,13 @@
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Discord.Net.Core, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="Discord.Net.Core, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Discord.Net.Core.1.0.2\lib\net45\Discord.Net.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Discord.Net.Rest, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="Discord.Net.Rest, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Discord.Net.Rest.1.0.2\lib\net45\Discord.Net.Rest.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Discord.Net.WebSocket, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="Discord.Net.WebSocket, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Discord.Net.WebSocket.1.0.2\lib\net45\Discord.Net.WebSocket.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="LibGit2Sharp, Version=1.0.22.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
|
||||
|
||||
@@ -9,6 +9,8 @@ $flags = [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Ex
|
||||
|
||||
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList "$bf/Tools/TGStationServer3.pfx", $env:snk_passphrase, $flags
|
||||
|
||||
$env:snk_passphrase = ""
|
||||
|
||||
$provider = [System.Security.Cryptography.RSACryptoServiceProvider]$cert.PrivateKey;
|
||||
|
||||
$rawstring = $provider.ExportCspBlob($true)
|
||||
@@ -17,6 +19,34 @@ $rawstring = $provider.ExportCspBlob($true)
|
||||
|
||||
&'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\sn.exe' -i "$bf/Tools/TGStationServer3.snk" TGStationServer3
|
||||
|
||||
#sign the discord binaries while we're here
|
||||
|
||||
function ReplaceTextInFile
|
||||
{
|
||||
param($text, $replacement, $file)
|
||||
(Get-Content -Raw "$file").replace($text, $replacement) | Set-Content "$file"
|
||||
}
|
||||
|
||||
function SignDLL
|
||||
{
|
||||
param($path, $depends)
|
||||
|
||||
&'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\ildasm.exe' "$path" /OUTPUT="$path.il" > $null
|
||||
|
||||
foreach ($dep in $depends) {
|
||||
$ILPKTokStr = "`r`n .publickeytoken = (15 21 FB 3F E7 6E D9 10 )"
|
||||
ReplaceTextInFile ".assembly extern $dep`r`n{" ".assembly extern $dep`r`n{$ILPKTokStr" "$path.il"
|
||||
}
|
||||
|
||||
&'C:\Windows\Microsoft.NET\Framework\v4.0.30319\ilasm.exe' "$path.il" /DLL /OUTPUT="$path" /KEY="$bf/Tools/TGStationServer3.snk" > $null
|
||||
Write-Host "Signed $path"
|
||||
}
|
||||
|
||||
SignDLL "$bf/packages/Discord.Net.Core.1.0.2/lib/net45/Discord.Net.Core.dll" @()
|
||||
SignDLL "$bf/packages/Discord.Net.Rest.1.0.2/lib/net45/Discord.Net.Rest.dll" @("Discord.Net.Core")
|
||||
SignDLL "$bf/packages/Discord.Net.WebSocket.1.0.2/lib/net45/Discord.Net.WebSocket.dll" @("Discord.Net.Core", "Discord.Net.Rest")
|
||||
|
||||
Remove-Item "$bf/Tools/TGStationServer3.snk"
|
||||
|
||||
$env:snk_passphrase = ""
|
||||
#Replace bad references with our PKTok 1521fb3fe76ed910
|
||||
ReplaceTextInFile 'PublicKeyToken=null' 'PublicKeyToken=1521fb3fe76ed910' "$bf/TGServerService/TGServerService.csproj"
|
||||
|
||||
Reference in New Issue
Block a user