You're welcome to do pull requests. :)
But bear in mind that these are my first ever C# projects, and as such I only have a basic understanding of its various features and quirks. So I would appreciate if you could add some details how your code works and what it does, so I can better understand what you did. Thanks!
Open the terminal in the project folder and type:
cd ModName- Select the mod to builddotnet restore- Install dependenciesmsbuild- Build the mod
Apparently this setup is not compatible with MonoDevelop out-of-the-box. You could do the following:
- Create a new project in MonoDevelop
- Copy-paste the
manifest.jsonandsrcfolder into the project - Add NuGet packages:
Microsoft.Net.Compilers v3.3.1,Pathoschild.Stardew.ModBuildConfig v3.2.2
Optional. Just in case you use it.
- Get the ms-dotnettools.csharp extension
- When using Mono, add
"omnisharp.useGlobalMono": "always"to yoursettings.json
Some things I encountered when setting up the project.
Roslyn is in another castle. Just create a symlink:
/usr/lib/mono/msbuild/15.0/bin $ sudo ln -s /usr/lib/mono/msbuild/Current/bin/Roslyn/ Roslyn
Create file stardewvalley.targets in your home directory:
<Project>
<PropertyGroup>
<GamePath>/full/path/to/Stardew Valley/game/</GamePath>
</PropertyGroup>
</Project>
Sources:
- https://github.com/Pathoschild/SMAPI/blob/develop/docs/technical/mod-package.md#configure
- https://github.com/Pathoschild/SMAPI/blob/develop/docs/technical/mod-package.md#custom-game-path
Do you use VSCode with Mono? See the VSCode section above.
Source: dotnet/vscode-csharp#4007 (comment)
Fixes for these are stored in the repo, so no need to worry about them. I hope. But for reference, here's what happened.
NuGet -> Microsoft.Net.Compilers -> 3.3.1
dotnet add package Microsoft.Net.Compilers -v 3.3.1
Source: https://stackoverflow.com/a/61585773
Error: 'There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "StardewValley", "x86".'
Add the following to the ModName.csproj file:
<PropertyGroup>
<Platform>x86</Platform>
...
</PropertyGroup>
Type those into the SMAPI terminal.
- Give item to player:
debug item $itemId $amount - Set time to 11:00am:
debug time 1100 - Set day of the current month to the 28th:
debug day 28 - Set season to winter:
debug season winter - Increase movement speed by 5x for the day:
debug speed 5 1200 - Warp to bed:
debug wh
Source: https://stardewvalleywiki.com/Modding:Debug_commands
Mainly as notes to myself.
- New solution:
dotnet new sln - New project:
dotnet new classLib --name ModName - Add project to solution:
dotnet sln add ModName/ModName.csproj - Add package via NuGet:
dotnet add package Microsoft.Net.Compilers -v 3.3.1 - Install packages in an existing repo:
dotnet restore - Build a specific target:
msbuild /property:Configuration=Release
Sources: