Skip to content

Commit 8908e46

Browse files
committed
Upgrade template to net10 and Remora.Resonite.Sdk
1 parent cdaa184 commit 8908e46

8 files changed

Lines changed: 41 additions & 127 deletions

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,8 @@ jobs:
4343
- name: Setup Dotnet
4444
uses: actions/setup-dotnet@v4
4545
with:
46-
dotnet-version: 8.x
47-
source-url: https://nuget.pkg.github.com/ResoniteModdingGroup/index.json
48-
49-
- name: Add MonkeyLoader NuGet Source
50-
run: dotnet nuget add source https://pkg.munally.com/MonkeyModdingTroop/index.json
51-
46+
dotnet-version: 10.x
47+
5248
- name: Restore NuGet Package Cache
5349
uses: actions/cache/restore@v4
5450
with:
@@ -68,11 +64,7 @@ jobs:
6864
run: dotnet test --no-restore --no-build
6965

7066
- name: Move NuGet Packages
71-
run: mv (Get-ChildItem -Recurse ./ -Include *.nupkg) ./
72-
73-
# Removes the version number from the package name
74-
- name: Rename NuGet Packages
75-
run: Get-ChildItem -Include *.nupkg -Path ./* | Rename-Item -NewName { $_.Name -Replace '\.\d+\.\d+\.\d+.*$','.nupkg' }
67+
run: mv "./MonkeyLoader.ModTemplate/bin/publish/mod/client/MonkeyLoader/Mods/MonkeyLoader.ModTemplate.nupkg" ./MonkeyLoader.ModTemplate.nupkg
7668

7769
# Publish the NuGet package(s) as an artifact, so they can be used in the following jobs
7870
- name: Upload NuGet Packages Artifact
@@ -98,11 +90,7 @@ jobs:
9890
- name: Setup Dotnet
9991
uses: actions/setup-dotnet@v4
10092
with:
101-
dotnet-version: 8.x
102-
source-url: https://nuget.pkg.github.com/ResoniteModdingGroup/index.json
103-
104-
- name: Add MonkeyLoader NuGet Source
105-
run: dotnet nuget add source https://pkg.munally.com/MonkeyModdingTroop/index.json
93+
dotnet-version: 10.x
10694

10795
- name: Restore NuGet Package Cache
10896
uses: actions/cache/restore@v4
@@ -126,4 +114,4 @@ jobs:
126114
# If some rules are not applicable, you can disable them
127115
# using the --excluded-rules or --excluded-rule-ids option
128116
- name: Validate Package(s)
129-
run: meziantou.validate-nuget-package (Get-ChildItem -Recurse "${{ env.NuGetDirectory }}" -Include *.nupkg) --excluded-rules IconMustBeSet
117+
run: meziantou.validate-nuget-package "${{ env.NuGetDirectory }}/MonkeyLoader.ModTemplate.nupkg" --excluded-rules IconMustBeSet

.github/workflows/publish.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
uses: mikepenz/action-gh-release@v1 #softprops/action-gh-release
5050
with:
5151
body: ${{steps.build_changelog.outputs.changelog}}
52-
files: ${{ env.NuGetDirectory }}/*.nupkg
52+
files: ${{ env.NuGetDirectory }}/MonkeyLoader.ModTemplate.nupkg
5353
fail_on_unmatched_files: true
5454
fail_on_asset_upload_issue: true
5555
prerelease: ${{ contains(github.ref, '-') }} # simple check for vX.Y.Z-something
@@ -68,17 +68,10 @@ jobs:
6868
- name: Setup Dotnet
6969
uses: actions/setup-dotnet@v4
7070
with:
71-
dotnet-version: 8.x
72-
source-url: https://nuget.pkg.github.com/ResoniteModdingGroup/index.json
73-
74-
- name: Add MonkeyLoader NuGet Source
75-
run: dotnet nuget add source https://pkg.munally.com/MonkeyModdingTroop/index.json
71+
dotnet-version: 10.x
7672

7773
# Publish all NuGet packages to the GitHub feed
7874
# Use --skip-duplicate to prevent errors if a package with the same version already exists.
7975
# If you retry a failed workflow, already published packages will be skipped without error.
80-
- name: Publish NuGet Packages
81-
run: |
82-
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) {
83-
dotnet nuget push $file --api-key "${{ secrets.GITHUB_TOKEN }}" --source https://nuget.pkg.github.com/ResoniteModdingGroup/index.json --skip-duplicate
84-
}
76+
#- name: Publish NuGet Packages
77+
# run: dotnet nuget push "${{ env.NuGetDirectory }}/MonkeyLoader.ModTemplate.nupkg" --api-key "${{ secrets.GITHUB_TOKEN }}" --source https://nuget.pkg.github.com/ResoniteModdingGroup/index.json --skip-duplicate

Directory.Build.props

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,14 @@
11
<Project>
22
<PropertyGroup>
3-
<OutputType>Library</OutputType>
4-
<TargetFramework>net462</TargetFramework>
5-
<AssemblyFileName>$(AssemblyTitle).dll</AssemblyFileName>
6-
<LangVersion>11.0</LangVersion>
7-
<Nullable>enable</Nullable>
8-
<Deterministic>true</Deterministic>
9-
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
10-
<DebugType>portable</DebugType>
11-
<GenerateDocumentationFile>True</GenerateDocumentationFile>
12-
13-
<CopyToLibraries Condition="'$(CopyToLibraries)'==''">true</CopyToLibraries>
14-
15-
<RestoreAdditionalProjectSources>
16-
https://pkg.munally.com/MonkeyModdingTroop/index.json;
17-
https://pkg.munally.com/ResoniteModdingGroup/index.json
18-
</RestoreAdditionalProjectSources>
19-
</PropertyGroup>
20-
21-
<PropertyGroup>
22-
<PackageReadmeFile>README.md</PackageReadmeFile>
23-
<RepositoryUrl>$(PackageProjectUrl).git</RepositoryUrl>
24-
<RepositoryType>git</RepositoryType>
25-
<IncludeSymbols>False</IncludeSymbols>
26-
<EmbedAllSources>True</EmbedAllSources>
27-
<EmbedUntrackedSources>True</EmbedUntrackedSources>
28-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
29-
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
3+
<ResoniteInstallOnBuild Condition="'$(ResoniteInstallOnBuild)'==''">true</ResoniteInstallOnBuild>
304
</PropertyGroup>
31-
5+
326
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
337
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
34-
<CopyToLibraries>false</CopyToLibraries>
8+
<ResoniteInstallOnBuild>false</ResoniteInstallOnBuild>
359
</PropertyGroup>
3610

3711
<PropertyGroup Condition="'$(ResonitePath)'==''">
38-
<ResonitePath>$(MSBuildThisFileDirectory)Resonite</ResonitePath>
39-
<ResonitePath Condition="Exists('C:\Program Files (x86)\Steam\steamapps\common\Resonite\')">C:\Program Files (x86)\Steam\steamapps\common\Resonite</ResonitePath>
40-
<ResonitePath Condition="Exists('$(HOME)/.steam/steam/steamapps/common/Resonite/')">$(HOME)/.steam/steam/steamapps/common/Resonite</ResonitePath>
41-
<ResonitePath Condition="Exists('D:/Files/Games/Resonite/app/')">D:/Files/Games/Resonite/app</ResonitePath>
12+
<ResonitePath Condition="Exists('D:/Files/Games/Resonite/app')">D:/Files/Games/Resonite/app</ResonitePath>
4213
</PropertyGroup>
4314
</Project>

MonkeyLoader.ModTemplate.PrePatcher/BasicPrePatcher.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
using Mono.Cecil.Cil;
44
using Mono.Cecil.Rocks;
55
using MonoMod.Utils;
6-
using System;
7-
using System.Collections.Generic;
8-
using System.Linq;
9-
using System.Text;
10-
using System.Threading.Tasks;
116

127
namespace MonkeyLoader.ModTemplate
138
{
@@ -33,7 +28,7 @@ protected override bool Patch(PatchJob patchJob)
3328
var engineCCtor = engine.GetStaticConstructor();
3429

3530
var processor = engineCCtor.Body.GetILProcessor(); // using MonoMod.Utils; is important for this to work v
36-
processor.InsertBefore(engineCCtor.Body.Instructions.First(), processor.Create(OpCodes.Call, typeof(BasicPrePatcher).GetMethod(nameof(HelloMethod))));
31+
processor.InsertBefore(engineCCtor.Body.Instructions.First(), processor.Create(OpCodes.Call, typeof(BasicPrePatcher).GetMethod(nameof(HelloMethod))!));
3732

3833
patchJob.Changes = true;
3934
return true;
Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Remora.Resonite.Sdk">
22
<PropertyGroup>
3-
<AssemblyTitle>MonkeyLoader.ModTemplate.PrePatcher</AssemblyTitle>
43
<RootNamespace>MonkeyLoader.ModTemplate</RootNamespace>
54
</PropertyGroup>
6-
7-
<ItemGroup>
8-
<PackageReference Include="MonkeyLoader" Version="0.19.0-beta" />
9-
<!-- Prevent automatically referencing all DLLs from the Game Pack -->
10-
<PackageReference Include="MonkeyLoader.GamePacks.Resonite" Version="0.16.6-beta" ExcludeAssets="compile; build; runtime; native" GeneratePathProperty="true" />
11-
<PackageReference Include="PolySharp" Version="1.14.1">
12-
<PrivateAssets>all</PrivateAssets>
13-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14-
</PackageReference>
15-
<PackageReference Include="System.Text.Json" Version="8.0.4">
16-
<PrivateAssets>all</PrivateAssets>
17-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18-
</PackageReference>
19-
</ItemGroup>
20-
21-
<ItemGroup>
22-
<!-- Reference only the pre-patcher assembly from the Game Pack -->
23-
<Reference Include="MonkeyLoader.Resonite.Data">
24-
<HintPath>$(PkgMonkeyLoader_GamePacks_Resonite)\lib\net462\pre-patchers\MonkeyLoader.Resonite.Data.dll</HintPath>
25-
</Reference>
26-
</ItemGroup>
275
</Project>

MonkeyLoader.ModTemplate.sln

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{07124CF9-EE3D-4A7E-A2F8-8FD07966E423}"
99
ProjectSection(SolutionItems) = preProject
1010
Directory.Build.props = Directory.Build.props
11+
global.json = global.json
1112
README.md = README.md
1213
EndProjectSection
1314
EndProject
1415
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonkeyLoader.ModTemplate.PrePatcher", "MonkeyLoader.ModTemplate.PrePatcher\MonkeyLoader.ModTemplate.PrePatcher.csproj", "{F500B1A2-B913-4D93-941D-9BB5ABBDC800}"
1516
EndProject
17+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
18+
ProjectSection(SolutionItems) = preProject
19+
.github\workflows\build.yml = .github\workflows\build.yml
20+
.github\workflows\publish.yml = .github\workflows\publish.yml
21+
EndProjectSection
22+
EndProject
1623
Global
1724
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1825
Debug|Any CPU = Debug|Any CPU
@@ -31,6 +38,9 @@ Global
3138
GlobalSection(SolutionProperties) = preSolution
3239
HideSolutionNode = FALSE
3340
EndGlobalSection
41+
GlobalSection(NestedProjects) = preSolution
42+
{02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {07124CF9-EE3D-4A7E-A2F8-8FD07966E423}
43+
EndGlobalSection
3444
GlobalSection(ExtensibilityGlobals) = postSolution
3545
SolutionGuid = {7D505B2E-FBA2-4F50-BC1C-838BC8DF0D5C}
3646
EndGlobalSection
Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Remora.Resonite.Sdk">
22
<PropertyGroup>
3-
<AssemblyTitle>MonkeyLoader.ModTemplate</AssemblyTitle>
4-
<RootNamespace>MonkeyLoader.ModTemplate</RootNamespace>
5-
</PropertyGroup>
6-
7-
<PropertyGroup>
8-
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
93
<PackageId>MonkeyLoader.ModTemplate.Resonite</PackageId>
104
<Title>MonkeyLoader Resonite Mod Template</Title>
115
<Authors>Banane9</Authors>
12-
<Version>0.4.0</Version>
6+
<Version>0.5.0</Version>
137
<Description>This is a template for a Resonite MonkeyLoader mod.</Description>
148
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>
9+
<RepositoryType>git</RepositoryType>
1510
<PackageProjectUrl>https://github.com/ResoniteModdingGroup/MonkeyLoader.ModTemplate</PackageProjectUrl>
11+
<RepositoryUrl>$(PackageProjectUrl).git</RepositoryUrl>
12+
<PackageReadmeFile>README.md</PackageReadmeFile>
1613
<PackageTags>mod; mods; monkeyloader; resonite</PackageTags>
1714
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);AddExtraFilesToPackage</TargetsForTfmSpecificContentInPackage>
1815
</PropertyGroup>
@@ -26,44 +23,21 @@
2623

2724
<Target Name="AddExtraFilesToPackage">
2825
<ItemGroup>
29-
<TfmSpecificPackageFile Include="$(ProjectDir)..\MonkeyLoader.ModTemplate.PrePatcher\bin\$(Configuration)\$(TargetFramework)\MonkeyLoader.ModTemplate.PrePatcher.*" PackagePath="lib/$(TargetFramework)/pre-patchers/" />
26+
<TfmSpecificPackageFile Include="$(ProjectDir)../MonkeyLoader.ModTemplate.PrePatcher/bin/$(Configuration)/mod/client/MonkeyLoader.ModTemplate.PrePatcher.*" PackagePath="lib/$(TargetFramework)/pre-patchers/" />
3027
</ItemGroup>
3128
</Target>
32-
33-
<Target Name="CopyPackage" AfterTargets="Pack">
34-
<Copy Condition="'$(CopyToLibraries)'=='true'" SourceFiles="$(OutputPath)..\$(PackageId).$(PackageVersion).nupkg" DestinationFiles="$(ResonitePath)\MonkeyLoader\Mods\$(PackageId).nupkg" />
35-
<Message Condition="'$(CopyToLibraries)'=='true'" Text="Copied '$(OutputPath)..\$(PackageId).$(PackageVersion).nupkg' to '$(ResonitePath)\MonkeyLoader\Mods\$(PackageId).nupkg'" Importance="high" />
36-
</Target>
3729

3830
<ItemGroup>
39-
<None Include="..\README.md" Pack="true" PackagePath="" />
40-
<None Include="Locale\*" Pack="true" PackagePath="content/Locale/" />
31+
<None Include="../README.md" Pack="true" PackagePath="" />
32+
<None Include="Locale/*" Pack="true" PackagePath="content/Locale/" />
4133
</ItemGroup>
4234

4335
<ItemGroup>
44-
<PackageReference Include="MonkeyLoader" Version="0.19.0-beta" />
45-
<PackageReference Include="MonkeyLoader.GamePacks.Unity" Version="0.6.0-beta" />
46-
<PackageReference Include="MonkeyLoader.GamePacks.Resonite" Version="0.16.6-beta" GeneratePathProperty="true" />
47-
<PackageReference Include="PolySharp" Version="1.14.1">
48-
<PrivateAssets>all</PrivateAssets>
49-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
50-
</PackageReference>
51-
<PackageReference Include="Resonite.Elements.Core" Version="1.0.2" />
52-
<PackageReference Include="Resonite.FrooxEngine" Version="2024.6.11.74" />
53-
<PackageReference Include="System.Text.Json" Version="8.0.4">
54-
<PrivateAssets>all</PrivateAssets>
55-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
56-
</PackageReference>
36+
<ResoniteReference Include="FrooxEngine" />
37+
<ResoniteReference Include="Elements.Core" />
5738
</ItemGroup>
5839

5940
<ItemGroup>
60-
<!-- Reference the pre-patcher assembly from the Game Pack because PackageReference is stupid -->
61-
<Reference Include="MonkeyLoader.Resonite.Data">
62-
<HintPath>$(PkgMonkeyLoader_GamePacks_Resonite)\lib\net462\pre-patchers\MonkeyLoader.Resonite.Data.dll</HintPath>
63-
</Reference>
64-
</ItemGroup>
65-
66-
<ItemGroup>
67-
<ProjectReference Include="..\MonkeyLoader.ModTemplate.PrePatcher\MonkeyLoader.ModTemplate.PrePatcher.csproj" PrivateAssets="All" />
41+
<ProjectReference Include="../MonkeyLoader.ModTemplate.PrePatcher/MonkeyLoader.ModTemplate.PrePatcher.csproj" PrivateAssets="All" />
6842
</ItemGroup>
6943
</Project>

global.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"msbuild-sdks": {
3+
"Remora.Resonite.Sdk": "2.0.10"
4+
}
5+
}

0 commit comments

Comments
 (0)