Skip to content

Commit

Permalink
[MTGOSDK] Use netstandard2.0 TFM for core build
Browse files Browse the repository at this point in the history
  • Loading branch information
Qonfused committed Mar 31, 2024
1 parent cd114b6 commit 59cfb00
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 32 deletions.
41 changes: 20 additions & 21 deletions MTGOSDK/MTGOSDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,34 @@
</NoWarn>
</PropertyGroup>

<!-- Import MTGOSDK package properties -->
<Import Project="MTGOSDK.pkg.props" />

<ItemGroup>
<PackageReference Include="Microsoft.CSharp"
Version="4.7.0" />
<PackageReference Include="Microsoft.Diagnostics.Runtime"
Version="3.1.512801" />
<PackageReference Include="Meziantou.Polyfill"
Version="1.0.37" />
Version="1.0.37"
Condition="'$(TargetFramework)' == 'netstandard2.0'" />
<PackageReference Include="ImpromptuInterface"
Version="8.0.4" />
<PackageReference Include="Newtonsoft.Json"
Version="13.0.3" />
<ProjectReference Include="..\MTGOSDK.Win32\MTGOSDK.Win32.csproj" />
</ItemGroup>

<!-- Configures build-time resource dependencies for MSBuild -->
<!-- For builds used by the ScubaDiver assembly, exclude compiling the API -->
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<DefaultItemExcludes>$(DefaultItemExcludes);src\API\**</DefaultItemExcludes>
</PropertyGroup>

<!-- Import MTGOSDK reference assemblies -->
<Import Project="MTGOSDK.ref.props"
Condition="'$(TargetFramework)' != 'netstandard2.0'" />

<!-- Configures build-time resource dependencies for the main library -->
<Target Name="CollectResourceProjects"
BeforeTargets="ResolveProjectReferences"
Condition="'$(TargetFramework)' != 'netstandard2.0'">
Expand All @@ -41,33 +54,19 @@
</ItemGroup>
</Target>

<!-- Bundle all build artifacts into this assembly's resources -->
<!-- Bundle resource projects' build artifacts into the main library -->
<Target Name="EmbedResources"
BeforeTargets="CoreCompile"
AfterTargets="ResolveProjectReferences"
DependsOnTargets="CollectResourceProjects"
Condition="'@(ResourceProjects)' != ''">
<ItemGroup>
<ResourceFiles Include="$(SolutionDir)\dist\$(Configuration)\Win32\*.dll" />
<ResourceFiles Include="$(SolutionDir)\dist\$(Configuration)\Win32\*.exe" />
<ResourceFiles Include="$(SolutionDir)\dist\$(Configuration)\x64\*.dll" />
<ResourceFiles Include="$(SolutionDir)\dist\$(Configuration)\x64\*.exe" />
<ResourceFiles Include="$(SolutionDir)\dist\$(Configuration)\*.dll" />
<ResourceFiles Include="$(SolutionDir)\dist\$(Configuration)\Win32\*.*" />
<ResourceFiles Include="$(SolutionDir)\dist\$(Configuration)\x64\*.*" />
<ResourceFiles Include="$(SolutionDir)\dist\$(Configuration)\*.*" />
<EmbeddedResource Include="@(ResourceFiles)"
LogicalName="Resources\%(Filename)" />
LogicalName="Resources\%(Filename)%(Extension)" />
</ItemGroup>
</Target>

<!-- For builds used by the ScubaDiver assembly, exclude compiling the API -->
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<DefaultItemExcludes>$(DefaultItemExcludes);src\API\**</DefaultItemExcludes>
</PropertyGroup>

<!-- Import MTGOSDK package properties -->
<Import Project="MTGOSDK.pkg.props" />

<!-- Import MTGOSDK reference assemblies -->
<Import Project="MTGOSDK.ref.props"
Condition="'$(TargetFramework)' != 'netstandard2.0'" />

</Project>
6 changes: 0 additions & 6 deletions MTGOSDK/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,6 @@
"System.Reflection.Emit": "4.7.0"
}
},
"Meziantou.Polyfill": {
"type": "Direct",
"requested": "[1.0.37, )",
"resolved": "1.0.37",
"contentHash": "kFlH4Ye5lEK9AjViSWm32JrH3Ee42jd15FNnv4X4fK4JzdSlkMR7mqzsgRCBgZzszWLr0ioIA78dsMNxRoouSw=="
},
"Microsoft.CSharp": {
"type": "Direct",
"requested": "[4.7.0, )",
Expand Down
10 changes: 5 additions & 5 deletions MTGOSDK/src/Core/Remoting/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,21 @@ private static void GetInjectionToolkit(
remoteNetAppDataDirInfo.Create();

byte[] launcherResource = target.Is64Bit()
? ExtractResource(@"Resources\Launcher_x64")
: ExtractResource(@"Resources\Launcher");
? ExtractResource(@"Resources\Launcher_x64.exe")
: ExtractResource(@"Resources\Launcher.exe");
launcherPath = target.Is64Bit()
? Path.Combine(AppDataDir, "Launcher_x64.exe")
: Path.Combine(AppDataDir, "Launcher.exe");

byte[] adapterResource = target.Is64Bit()
? ExtractResource(@"Resources\Bootstrapper_x64")
: ExtractResource(@"Resources\Bootstrapper");
? ExtractResource(@"Resources\Bootstrapper_x64.dll")
: ExtractResource(@"Resources\Bootstrapper.dll");
var adapterPath = target.Is64Bit()
? Path.Combine(AppDataDir, "Bootstrapper_x64.dll")
: Path.Combine(AppDataDir, "Bootstrapper.dll");

// Get the .NET diver assembly to inject into the target process
byte[] diverResource = ExtractResource(@"Resources\Microsoft.Diagnostics.Runtime");
byte[] diverResource = ExtractResource(@"Resources\Microsoft.Diagnostics.Runtime.dll");
diverPath = Path.Combine(AppDataDir, "Microsoft.Diagnostics.Runtime.dll");

// Check if injector or bootstrap resources differ from copies on disk
Expand Down

0 comments on commit 59cfb00

Please sign in to comment.