Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.
Sinai edited this page Apr 11, 2022 · 15 revisions

Using the NuGet package

To use UniverseLib, add the NuGet Package(s) to your project.

UniverseLib has two NuGet packages:

If your mod only targets either IL2CPP or Mono (but not both), simply add a reference to the relevant NuGet package, the rest of this article is not applicable to you.

Universal Mono+IL2CPP projects

If you are building a mod which targets both Mono and IL2CPP, you will need separate build configurations for each target.

dotnet SDK projects (recommended)

For dotnet SDK-style projects, simply put each PackageReference in conditional ItemGroups. This example is assuming your build configurations are called IL2CPP and Mono, change that as needed.

<!-- IL2CPP NuGet -->
<ItemGroup Condition="'$(Configuration)'=='IL2CPP'">
    <PackageReference Include="UniverseLib.IL2CPP" Version="1.*" />
</ItemGroup>
<!-- Mono NuGet -->
<ItemGroup Condition="'$(Configuration)'=='Mono'">
    <PackageReference Include="UniverseLib.Mono" Version="1.*" />
</ItemGroup>

.NET Framework projects

For .NET Framework projects, the same idea applies, but both packages must be referenced by your project in your packages.config file, or added through the NuGet package manager.

You will need to manually manage the assembly references in your csproj file, and make sure it updates correctly whenever you bump the NuGet package version.

  • IMPORTANT: Make sure to change the X.X.Xs in both files with the UniverseLib version you are using.

packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="UniverseLib.Mono" version="X.X.X" targetFramework="net35" />
  <package id="UniverseLib.IL2CPP" version="X.X.X" targetFramework="net472" />
</packages>

.csproj file

<!-- IL2CPP References -->
<ItemGroup Condition="'$(Configuration)'=='IL2CPP'">
    <Reference Include="UniverseLib.IL2CPP">
        <HintPath>packages\UniverseLib.IL2CPP.X.X.X\lib\net472\UniverseLib.IL2CPP.dll</HintPath>
        <Private>True</Private>
    </Reference>
</ItemGroup>
<!-- Mono References -->
<ItemGroup Condition="'$(Configuration)'=='Mono'">
    <Reference Include="UniverseLib.Mono">
        <HintPath>packages\UniverseLib.Mono.X.X.X\lib\net35\UniverseLib.Mono.dll</HintPath>
        <Private>True</Private>
    </Reference>
</ItemGroup>

Clone this wiki locally