using ILRepack MSBuild task, adding some base libs

This commit is contained in:
sinaioutlander 2020-10-05 18:32:38 +11:00
parent 6a9c64c2a1
commit 912b1b80ff
9 changed files with 48 additions and 32 deletions

View File

@ -155,35 +155,7 @@ If you'd like to build this yourself, you will need to have installed BepInEx an
4. Open the `src\Explorer.sln` project. 4. Open the `src\Explorer.sln` project.
5. Select `Solution 'Explorer' (1 of 1 project)` in the Solution Explorer panel, and set the <b>Active config</b> property to the version you want to build, then build it. 5. Select `Solution 'Explorer' (1 of 1 project)` in the Solution Explorer panel, and set the <b>Active config</b> property to the version you want to build, then build it.
5. The DLLs are built to the `Release\` folder in the root of the repository. 5. The DLLs are built to the `Release\` folder in the root of the repository.
6. If ILRepack fails or is missing, use the NuGet package manager to re-install `ILRepack.Lib.MSBuild.Task`, then re-build.
[ILRepack](https://github.com/gluck/il-repack) is used to merge `lib\mcs.dll` and the release dll. Download the ILRepack nuget package and take the `ILRepack.exe` file from it.
Put `ILRepack.exe` in the `Release\` folder, then create a `merge.bat` file like so:
```batch
:: Set GameFolder to the full path of the game you have installed MelonLoader and/or BepInEx for.
SET GameFolder="..."
:: Only include the lines for the version(s) you are building.
:: MelonLoader Il2CPP:
ILRepack.exe /lib:"%GameFolder%\MelonLoader" /lib:"%GameFolder%\MelonLoader\Managed" /out:"Explorer.MelonLoader.Il2Cpp\Explorer.dll" "Explorer.MelonLoader.Il2Cpp\Explorer.dll" "..\lib\mcs.dll"
:: MelonLoader Mono
ILRepack.exe /lib:"..\lib" /lib:"%GameFolder%\MelonLoader" /out:"Explorer.MelonLoader.Mono\Explorer.dll" "Explorer.MelonLoader.Mono\Explorer.dll" "..\lib\mcs.dll"
:: MelonLoader Mono .NET35
ILRepack.exe /lib:"..\lib" /lib:"%GameFolder%\MelonLoader" /out:"Explorer.MelonLoader.Mono.NET35\Explorer.dll" "Explorer.MelonLoader.Mono.NET35\Explorer.dll" "..\lib\mcs.NET35.dll"
:: BepInEx Il2Cpp
ILRepack.exe /lib:"%GameFolder%\BepInEx\core" /lib:"%GameFolder%\BepInEx\unhollowed" /out:"Explorer.BepInEx.Il2Cpp\Explorer.dll" "Explorer.BepInEx.Il2Cpp\Explorer.dll" "..\lib\mcs.dll"
:: BepInEx Mono
ILRepack.exe /lib:"..\lib" /lib:"%GameFolder%\BepInEx\core" /out:"Explorer.BepInEx.Mono\Explorer.dll" "Explorer.BepInEx.Mono\Explorer.dll" "..\lib\mcs.dll"
:: BepInEx Mono .NET35
ILRepack.exe /lib:"..\lib" /lib:"%GameFolder%\BepInEx\core" /out:"Explorer.BepInEx.Mono.NET35\Explorer.dll" "Explorer.BepInEx.Mono.NET35\Explorer.dll" "..\lib\mcs.NET35.dll"
```
## Credits ## Credits

BIN
lib/0Harmony.dll Normal file

Binary file not shown.

BIN
lib/BepInEx.Core.dll Normal file

Binary file not shown.

BIN
lib/BepInEx.IL2CPP.dll Normal file

Binary file not shown.

BIN
lib/BepInEx.dll Normal file

Binary file not shown.

Binary file not shown.

View File

@ -28,11 +28,13 @@
<!-- Set this to the MelonLoader Il2Cpp Game folder, without the ending '\' character. --> <!-- Set this to the MelonLoader Il2Cpp Game folder, without the ending '\' character. -->
<MLCppGameFolder>D:\Steam\steamapps\common\Hellpoint</MLCppGameFolder> <MLCppGameFolder>D:\Steam\steamapps\common\Hellpoint</MLCppGameFolder>
<!-- Set this to the MelonLoader Mono Game folder, without the ending '\' character. --> <!-- Set this to the MelonLoader Mono Game folder, without the ending '\' character. -->
<MLMonoGameFolder>D:\Steam\steamapps\common\Outward</MLMonoGameFolder> <MLMonoGameFolder>D:\Steam\steamapps\common\Outward_Mono</MLMonoGameFolder>
<!-- Set this to the BepInEx Il2Cpp Game folder, without the ending '\' character. --> <!-- Set this to the BepInEx Il2Cpp Game folder, without the ending '\' character. -->
<BIECppGameFolder>D:\Steam\steamapps\common\Outward - Il2Cpp</BIECppGameFolder> <BIECppGameFolder>D:\Steam\steamapps\common\Outward</BIECppGameFolder>
<!-- Set this to the BepInEx Mono Game folder, without the ending '\' character. --> <!-- Set this to the BepInEx Mono Game folder, without the ending '\' character. -->
<BIEMonoGameFolder>D:\Steam\steamapps\common\Outward</BIEMonoGameFolder> <BIEMonoGameFolder>D:\Steam\steamapps\common\Outward_Mono</BIEMonoGameFolder>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_ML_Cpp|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_ML_Cpp|AnyCPU' ">
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
@ -275,5 +277,16 @@
<Compile Include="UnstripFixes\Internal.cs" /> <Compile Include="UnstripFixes\Internal.cs" />
<Compile Include="UnstripFixes\Internal_SliderState.cs" /> <Compile Include="UnstripFixes\Internal_SliderState.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="ILRepack.targets" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\ILRepack.Lib.MSBuild.Task.2.0.18.1\build\ILRepack.Lib.MSBuild.Task.targets" Condition="Exists('packages\ILRepack.Lib.MSBuild.Task.2.0.18.1\build\ILRepack.Lib.MSBuild.Task.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\ILRepack.Lib.MSBuild.Task.2.0.18.1\build\ILRepack.Lib.MSBuild.Task.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\ILRepack.Lib.MSBuild.Task.2.0.18.1\build\ILRepack.Lib.MSBuild.Task.targets'))" />
</Target>
</Project> </Project>

27
src/ILRepack.targets Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="ILRepacker" AfterTargets="Build">
<!-- Merging DLLs -->
<ItemGroup>
<InputAssemblies Include="$(OutputPath)$(AssemblyName).dll" />
</ItemGroup>
<ItemGroup Condition="'$(IsNet35)'=='false'">
<InputAssemblies Include="..\lib\mcs.dll" />
</ItemGroup>
<ItemGroup Condition="'$(IsNet35)'=='true'">
<InputAssemblies Include="..\lib\mcs.NET35.dll" />
</ItemGroup>
<ILRepack
Parallel="true"
Internalize="true"
DebugInfo="false"
LibraryPath="..\lib\"
InputAssemblies="@(InputAssemblies)"
TargetKind="Dll"
OutputFile="$(OutputPath)$(AssemblyName).dll"
/>
</Target>
</Project>

4
src/packages.config Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ILRepack.Lib.MSBuild.Task" version="2.0.18.1" targetFramework="net472" />
</packages>