Skip to content

Commit 9e6f8f7

Browse files
authored
Added NuGet (#247)
* NuGet * Fix Version Crash
1 parent a7c5c7b commit 9e6f8f7

File tree

4 files changed

+55
-44
lines changed

4 files changed

+55
-44
lines changed

LabApi/Features/LabApiProperties.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Reflection;
23

34
namespace LabApi.Features;
45

@@ -13,10 +14,26 @@ public static class LabApiProperties
1314
///
1415
/// <para>Due to being a constant, the value of this field will always be that of its compilation time version.</para>
1516
/// </summary>
16-
public const string CompiledVersion = "1.0.0.0";
17+
public static readonly string CompiledVersion = GetCompiledVersion();
1718

1819
/// <summary>
1920
/// Indicates the value of <see cref="CompiledVersion"/> the server is currently using.
2021
/// </summary>
2122
public static readonly Version CurrentVersion = Version.Parse(CompiledVersion);
23+
24+
private static string GetCompiledVersion()
25+
{
26+
const string defaultVersion = "0.0.0.0";
27+
28+
Assembly assembly = Assembly.GetExecutingAssembly();
29+
AssemblyInformationalVersionAttribute att = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
30+
31+
if (att == null)
32+
return defaultVersion;
33+
34+
string version = att.InformationalVersion ?? defaultVersion;
35+
int index = version.IndexOf('+');
36+
37+
return version[..index];
38+
}
2239
}

LabApi/LabApi.csproj

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,27 @@
66
<PlatformTarget>x64</PlatformTarget>
77

88
<LangVersion>12.0</LangVersion>
9+
<Version>1.0.2</Version>
10+
11+
<AssemblyName>LabApi</AssemblyName>
12+
<PackageId>Northwood.LabAPI</PackageId>
13+
<Authors>Northwood Studios</Authors>
14+
<Company>Northwood Studios</Company>
15+
<Description>The LabAPI project is SCP: Secret Laboratory's official server-side plugin loader and framework.</Description>
16+
<PackageTags>SCPSL, API, Framework, Plugin, SL, Development</PackageTags>
17+
<PackageProjectUrl>https://www.nuget.org/packages/Northwood.LabAPI/</PackageProjectUrl>
18+
<RepositoryUrl>https://github.com/northwood-studios/LabAPI/</RepositoryUrl>
19+
<RepositoryType>git</RepositoryType>
20+
<Copyright>© 2025 Northwood Studios</Copyright>
921

10-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
11-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1222
<Nullable>enable</Nullable>
1323
<Platforms>AnyCPU</Platforms>
24+
25+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
26+
<IncludeSymbols>true</IncludeSymbols>
27+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
28+
<PackageReadmeFile>README.md</PackageReadmeFile>
29+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
1430

1531
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
1632
</PropertyGroup>
@@ -22,7 +38,12 @@
2238
<PropertyGroup>
2339
<TextTemplateTransformSkipUpToDate>false</TextTemplateTransformSkipUpToDate>
2440
</PropertyGroup>
25-
41+
42+
<ItemGroup>
43+
<None Include="..\README.md" Pack="true" PackagePath="" />
44+
<None Include="$(SolutionDir)LICENSE" Pack="true" PackagePath="" />
45+
</ItemGroup>
46+
2647
<ItemGroup>
2748
<Reference Include="Assembly-CSharp" HintPath="$(SL_REFERENCES)\Assembly-CSharp.dll" />
2849
<Reference Include="Assembly-CSharp-firstpass" HintPath="$(SL_REFERENCES)\Assembly-CSharp-firstpass.dll" />
@@ -42,7 +63,7 @@
4263
<ItemGroup>
4364
<ProjectReference Include="..\LabApi.SourceGenerators\LabApi.SourceGenerators\LabApi.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
4465
</ItemGroup>
45-
66+
4667
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
4768
<Copy SourceFiles="$(TargetDir)$(TargetName).dll" DestinationFolder="$(SL_SOURCE)\Assets\Plugins" Condition=" '$(SL_SOURCE)' != '' " />
4869
</Target>

LabApi/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 36 deletions
This file was deleted.

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1+
[![GitHub release](https://flat.badgen.net/github/release/northwood-studios/LabAPI/)](https://github.com/northwood-studios/NwPluginAPI/releases/) [![NuGet](https://flat.badgen.net/nuget/v/Northwood.LabAPI/latest)](https://www.nuget.org/packages/Northwood.LabAPI/) [![License](https://flat.badgen.net/github/license/northwood-studios/LabAPI)](https://github.com/northwood-studios/LabAPI/blob/master/LICENSE) [![Discord Invitation](https://flat.badgen.net/discord/members/scpsl?icon=discord)](https://discord.gg/scpsl)
12
# LabAPI
3+
The LabAPI project is **[SCP: Secret Laboratory](https://store.steampowered.com/app/700330/SCP_Secret_Laboratory/)**'s official server-side plugin loader and framework. It facilitates development of plugins by providing wrappers and events around various game mechanics found throughout the game.
24

3-
Welcome to the **LabAPI Public Beta**. We are still building the initial README as we move towards the full release.
5+
## Documentation
6+
Code should have self-explanatory documentation, but there's only so much you can explain through comments!
7+
- For guides, tips and tricks, our main source of documentation can be found [here](https://github.com/northwood-studios/LabAPI/wiki).
8+
- For a more practical approach, examples can be found [here](https://github.com/northwood-studios/LabAPI/tree/master/LabApi.Examples).
49

5-
In the meantime, we suggest you use the following **Wiki** tab as your main source of documentation:
6-
https://github.com/northwood-studios/LabAPI/wiki
10+
## Installation
11+
All **SCP: SL Dedicated Server** builds are bundled with a compiled **`LabAPI.dll`**, so you don't need to install it if you are hosting a server.
12+
13+
However, [releases](https://github.com/northwood-studios/LabAPI/releases) may occasionally occur *before* the dedicated server is updated, while we advice you wait for an official update, you can always apply the updated release manually.
14+
15+
To do so, you should update the **`LabAPI.dll`** file located within: `%DEDICATED_SERVER_PATH%/SCPSL_Data/Managed/`.

0 commit comments

Comments
 (0)