Linkoid.LethalCompany.Test.Build
1.0.2
See the version list below for details.
dotnet add package Linkoid.LethalCompany.Test.Build --version 1.0.2
NuGet\Install-Package Linkoid.LethalCompany.Test.Build -Version 1.0.2
<PackageReference Include="Linkoid.LethalCompany.Test.Build" Version="1.0.2"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Linkoid.LethalCompany.Test.Build --version 1.0.2
#r "nuget: Linkoid.LethalCompany.Test.Build, 1.0.2"
// Install Linkoid.LethalCompany.Test.Build as a Cake Addin #addin nuget:?package=Linkoid.LethalCompany.Test.Build&version=1.0.2 // Install Linkoid.LethalCompany.Test.Build as a Cake Tool #tool nuget:?package=Linkoid.LethalCompany.Test.Build&version=1.0.2
Lethal Company Test Build SDK
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
- Automatically locates local Lethal Company installation with Linkoid.LethalCompany.Common.Build.
- Generates a
.runsettings
file with machine-specific file paths by using Linkoid.Build.Tasks.RunSettings. - Copies files to the referenced plugin's folder instead of it's own separate folder. (If plugin copying is enabled.)
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
- Disabled by default to match convention where tests cannot be run with play button or
<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
- If
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.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Linkoid.Build.Tasks.RunSettings (>= 1.0.3)
- Linkoid.LethalCompany.Common.Build (>= 1.0.2)
- Linkoid.LethalCompany.Plugin.Build (>= 1.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.