This is PowerShell
(https://learn.microsoft.com/en-us/powershell/) script for generating and maintaining 2 files: mod.yaml
and mod_info.yaml
, required as part of mod making for the game Oxygen Not Included.
In your c# project create folder Engine
and put inside AssemblyInfo.cs
which should contain at least the version information and the tile:
[assembly: AssemblyTitle("FavoriteBuildings")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
In Directory.props
or .csproj
of your c# project add:
<PropertyGroup>
<LibDir>your_path</LibDir>
</PropertyGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="PowerShell -executionpolicy bypass -File "$(LibDir)update-version-script.ps1" -assemblyInfoPath "$(ProjectDir)Engine\AssemblyInfo.cs" -modInfoPath "$(ProjectDir)mod_info.yaml" -gameAssemblyPath "$(GameManaged)Assembly-CSharp.dll"" ContinueOnError="false" />
</Target>
As you can see it is using the paths as the arguments, so if you want - you can easily edit it.
Change LibDir
to the path of the directory where you located the update-version-script.ps
.
Change GameManaged
to the path of the directory where game Assembly-CSharp.dll is located.
Each time the you will build the project, it will generate mod.yaml
and mod_info.yaml
files for you.
It will also grab and update the actual build number from the game, which is storred in KleiVersion
class in Assembly-CSharp.dll.
supportedContent: ALL
minimumSupportedBuild: 619020 # will be auto updated from the Assembly-CSharp.dll
APIVersion: 2
version: 1.0.0.0 # will be changed to your project version from AssemblyInfo.cs
staticID: FavoriteBuildings # the name will be taken from your Project Name, stored in AssemblyTitle of the AssemblyInfo.cs