Skip to content

EN CSharp Libraries NuGet

Codex edited this page Oct 11, 2026 · 2 revisions

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

Libraries, projects and NuGet

Manual C# · Examples UO

Library .dll contains compiled types. A regular .csproj can reference another project, a local library, or a NuGet package. using connects the names but does not add the missing assembly; The dependency must be available to the compiler at startup.

Simple example (Example.cs)

Save this example separately as Example.cs. Run it independently of the other examples on this page.

Example.cs:

// PROJECT-EXAMPLE
System.Console.WriteLine(System.Math.Abs(-3));

Result:

3
<ItemGroup>
  <ProjectReference Include="../Shared/Shared.csproj" />
  <Reference Include="LocalLibrary">
    <HintPath>lib/LocalLibrary.dll</HintPath>
  </Reference>
</ItemGroup>

In a standard project, the NuGet dependency is declared as PackageReference with the version selected. dotnet restore restores packages, dotnet build compiles the project. To work with .csproj you need SDK; regular runtime and SDK solve different problems.

For the .csx script, there are #r directives for the assembly reference and #load for the source script if configured by the host. The connection method for the game API and the user project input point are described separately in the IDE templates. Do not create a second independent game session object inside the library.

Official documentation: Libraries, Projects and NuGet - Microsoft Learn.

Clone this wiki locally