Linkoid.LethalCompany.Test.Build 1.0.3

dotnet add package Linkoid.LethalCompany.Test.Build --version 1.0.3                
NuGet\Install-Package Linkoid.LethalCompany.Test.Build -Version 1.0.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Linkoid.LethalCompany.Test.Build" Version="1.0.3">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Linkoid.LethalCompany.Test.Build --version 1.0.3                
#r "nuget: Linkoid.LethalCompany.Test.Build, 1.0.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Linkoid.LethalCompany.Test.Build as a Cake Addin
#addin nuget:?package=Linkoid.LethalCompany.Test.Build&version=1.0.3

// Install Linkoid.LethalCompany.Test.Build as a Cake Tool
#tool nuget:?package=Linkoid.LethalCompany.Test.Build&version=1.0.3                

Lethal Company Test Build SDK

GitHub Stars License

Lethal Company dotnet MSBuild

Provides MSBuild properties and targets for creating a project which tests a Lethal Company plugin.

Usage

To use this package, add a package reference to the project:

<PackageReference Include="Linkoid.LethalCompany.Test.Build" Version="*" PrivateAssets="all" />

Features

MSBuild Properties

This package inherits all the properties from LethalCompany.Plugin.Build with some default values changed:

  • <StartGameOnRun>
    • Disabled by default to match convention where tests cannot be run with play button or dotnet run.
    • Default: false
  • <CopyFilesToPluginOutputDirectoryOnBuild> and <CopyFilesToPluginOutputDirectoryOnRun>
    • If true, will copy build output to the same plugin folder as the first <ProjectReference> to a lethal company plugin found.
    • Test assemblies often stand alone and are not required dependencies for a plugin unless using a test injection framework such as SmiteUnit.
    • Default: false

Generated .runsettings File

When the project is built, this package will automatically generate a .runsettings file via Linkoid.Build.Tasks.RunSettings. The following environment variables are included in the generated file:

  • GAME_DIRECTORY: The full path to the Lethal Company game folder.
  • GAME_EXE_PATH: The full path to the Lethal Company executable.
  • BEPINEX_DIRECTORY: The full path to the BepInEx folder.

The values are determined at build time by the MSBuild properties of respective name. These environment variables can be used in the test program to avoid hardcoding file paths:

string cosmeticsDirectory = "%BEPINEX_DIRECTORY%/plugins/MoreCompanyCosmetics";
cosmeticsDirectory = System.Environment.ExpandEnvironmentVariables(cosmeticsDirectory);
foreach (string cosmeticFile in System.IO.Directory.EnumerateFiles(cosmeticsDirectory))
{
    AssertMyPluginWorksWith(cosmeticFile);
}

[!NOTE] These environment variables will only be set in the test environment and should not be used in the plugin itself.

Example

An example of using this SDK can be seen in the SmiteUnitTests Template.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 103 9/23/2024
1.0.2 87 9/22/2024
1.0.1 87 9/22/2024
1.0.0 96 9/21/2024