Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ dotnet new install UltraModding.Templates
```
This will install the following template:

| Templates | Short Name | Language | Tags |
|-----------------------------------|----------------|----------|--------------------------------------|
| Ultrakill Minimal Plugin Template | `ukplugin-min` | `[C#]` | `BepInEx/BepInEx 5/Plugin/Ultrakill` |
| Templates | Short Name | Language | Tags |
|-----------------------------------|-----------------|----------|--------------------------------------|
| Ultrakill Full Plugin Template | `ukplugin-full` | `[C#]` | `BepInEx/BepInEx 5/Plugin/Ultrakill` |
| Ultrakill Minimal Plugin Template | `ukplugin-min` | `[C#]` | `BepInEx/BepInEx 5/Plugin/Ultrakill` |

## Using a template

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ Generates `MyPluginInfo.cs` based on csproj tags.
Define the following properties in your `csproj`:

```xml
<GUID>Example.Plugin</GUID>
<Product>My first plugin</Product>
<GUID>com.example.plugin</GUID>
<Product>Example Plugin</Product>
<Version>1.0.0</Version>
```

this will generate the following class:

```cs
namespace Example.Plugin;

internal static class MyPluginInfo
{
public const string PLUGIN_GUID = "Example.Plugin";
public const string PLUGIN_NAME = "My first plugin";
public const string PLUGIN_GUID = "com.example.plugin";
public const string PLUGIN_NAME = "Example Plugin";
public const string PLUGIN_VERSION = "1.0.0";
}
```
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Package Identity">
<PackageId>UltraModding.PluginInfoProps</PackageId>
<Version>3.0.0</Version>
<PackageId>UltraModding.PluginInfoGenerator</PackageId>
<Version>4.0.0</Version>
<Authors>BepInEx;10_days_till_xmas</Authors>
<PackageTags>BepInEx;Ultrakill;Build;Props</PackageTags>
<RootNamespace>UltraModding.PluginInfoProps</RootNamespace>
</PropertyGroup>

<PropertyGroup Label="Package Description">
<Description>Helper build target that generates a MyPluginInfo class based on assembly metadata.</Description>
<Description>
Helper build target that generates a MyPluginInfo class based on assembly metadata.
</Description>
<PackageReleaseNotes>
Initial nuget release. Generates a MyPluginInfo class based on assembly metadata.
- Use the GUID, Product, and Version properties to set the values.
Renamed the package and deprecated UltraModding.PluginInfoProps
</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Copyright>Original (c) 2021 BepInEx; Modified (c) 2025 UltraModding Contributors</Copyright>
</PropertyGroup>

<PropertyGroup Label="Repository Metadata">
<PackageProjectUrl>https://github.com/UltraModding/UltraModding.Templates/tree/master/UltraModding.PluginInfoProps</PackageProjectUrl>
<PackageProjectUrl>https://github.com/UltraModding/UltraModding.Templates/tree/master/UltraModding.PluginInfoGenerator</PackageProjectUrl>
<RepositoryUrl>https://github.com/UltraModding/UltraModding.Templates</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>
Expand All @@ -36,7 +38,7 @@
</PropertyGroup>

<ItemGroup>
<Content Include="UltraModding.PluginInfoProps.props" />
<Content Include="UltraModding.PluginInfoGenerator.targets" />
<None Include="README.md" Pack="true" PackagePath="" />
<Compile Remove="**\*" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project>
<Target Name="AddGeneratedFile" BeforeTargets="BeforeCompile;CoreCompile"
Inputs="$(MSBuildAllProjects)" Outputs="$(IntermediateOutputPath)GeneratedFile.cs">
<PropertyGroup>
<PluginGuid Condition="'$(PluginGuid)' == ''">$(GUID)</PluginGuid>
<PluginName Condition="'$(PluginName)' == ''">$(Product)</PluginName>
<PluginVersion Condition="'$(PluginVersion)' == ''">$(Version)</PluginVersion>
<GeneratedText><![CDATA[
namespace $(RootNamespace)%3B

internal static class MyPluginInfo
{
public const string PLUGIN_GUID = "$(PluginGuid)"%3B
public const string PLUGIN_NAME = "$(PluginName)"%3B
public const string PLUGIN_VERSION = "$(PluginVersion)"%3B
}
]]></GeneratedText>
<GeneratedFilePath>$(IntermediateOutputPath)MyPluginInfo.cs</GeneratedFilePath>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(GeneratedFilePath)" />
<FileWrites Include="$(GeneratedFilePath)" />
</ItemGroup>
<WriteLinesToFile Lines="$(GeneratedText)" File="$(GeneratedFilePath)" WriteOnlyWhenDifferent="true" Overwrite="true" />
<Warning Condition="'$(GUID)' == ''" Text="$(AssemblyName).csproj doesnt contain a &lt;GUID&gt; tag" />
</Target>
</Project>
27 changes: 0 additions & 27 deletions UltraModding.PluginInfoProps/UltraModding.PluginInfoProps.props

This file was deleted.

2 changes: 2 additions & 0 deletions UltraModding.Templates.Tests/ProjectTemplateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ public async Task FullProjectTemplate_Generated_Project_Builds()
const string version = "2.3.4";
const string ultrakillDirectory = "C:/Program Files (x86)/Steam/steamapps/common/ULTRAKILL/";
const string pluginsDirectory = $"{ultrakillDirectory}BepInEx/plugins/";

Assert.SkipUnless(Directory.Exists(pluginsDirectory),
$"Ultrakill plugins directory '{pluginsDirectory}' does not exist. Skipping test.");

var cancellationToken = TestContext.Current.CancellationToken;
using TempDir tempDir = new();

Expand Down
2 changes: 1 addition & 1 deletion UltraModding.Templates.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VisualStudioVersion = 17.13.35931.197
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UltraModding.Templates", "UltraModding.Templates\UltraModding.Templates.csproj", "{C57C43F6-3BCC-42C5-83C3-48DD6CA51245}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UltraModding.PluginInfoProps", "UltraModding.PluginInfoProps\UltraModding.PluginInfoProps.csproj", "{E05232A2-D0AD-435C-8C16-BC954E43E97B}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UltraModding.PluginInfoGenerator", "UltraModding.PluginInfoGenerator\UltraModding.PluginInfoGenerator.csproj", "{E05232A2-D0AD-435C-8C16-BC954E43E97B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Assets", "Assets", "{BD2D4189-0F06-4F95-9E6A-61B0B6468BCF}"
ProjectSection(SolutionItems) = preProject
Expand Down
9 changes: 5 additions & 4 deletions UltraModding.Templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

A collection of .NET project templates for Ultrakill plugins using BepInEx 5.

| Templates | Short Name | Language | Tags |
|-----------------------------------|-----------------|------------|---------------------------------------|
| Ultrakill Minimal Plugin Template | `ukplugin-min` | `[C#]` | `BepInEx/BepInEx 5/Plugin/Ultrakill` |
| Templates | Short Name | Language | Tags |
|-----------------------------------|-----------------|----------|--------------------------------------|
| Ultrakill Full Plugin Template | `ukplugin-full` | `[C#]` | `BepInEx/BepInEx 5/Plugin/Ultrakill` |
| Ultrakill Minimal Plugin Template | `ukplugin-min` | `[C#]` | `BepInEx/BepInEx 5/Plugin/Ultrakill` |


## Using a template

To use a template, you can use the `dotnet new` command.
To use a template, use the `dotnet new` command.
If you use Rider or Visual Studio 2022, you will be able to select the templates when creating a new solution.

For example, to create an Ultrakill plugin project:
Expand Down
2 changes: 1 addition & 1 deletion UltraModding.Templates/UltraModding.Templates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup Label="Package Identity">
<PackageId>UltraModding.Templates</PackageId>
<PackageVersion>2.0.0</PackageVersion>
<PackageVersion>2.0.1</PackageVersion>
<Authors>BepInEx;10_days_till_xmas</Authors>
<PackageTags>BepInEx;Plugin;Template;Ultrakill</PackageTags>
<PackageType>Template</PackageType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<ItemGroup>
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" />
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="UltraModding.PluginInfoProps" Version="3.0.0" />
<PackageReference Include="UltraModding.PluginInfoGenerator" Version="4.*" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.28" IncludeAssets="compile" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<ItemGroup>
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" />
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="UltraModding.PluginInfoProps" Version="3.0.0" />
<PackageReference Include="UltraModding.PluginInfoGenerator" Version="4.*" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.28" IncludeAssets="compile" />
</ItemGroup>

Expand Down