Skip to content

Commit cc7b850

Browse files
committed
Write more docs
All properties and most items are now documented. dependencies page now recommends using `ModReference`
1 parent b08da4a commit cc7b850

2 files changed

Lines changed: 133 additions & 43 deletions

File tree

docs/msbuild/configuration.md

Lines changed: 115 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,6 @@ default: `1.12 1.11 1.10 1.9 1.8`
2626
Used by the `CKANInstall` target to set additional KSP versions to treat as compatible when installing
2727
```
2828

29-
```{confval} KSPBT_GenerateAssemblyAttribute
30-
---
31-
default: `true`
32-
---
33-
If set to `true`, automatically generates the `KSPAssembly` for your assembly from the `Version` property.
34-
```
35-
36-
```{confval} KSPBT_GenerateDependencyAttributes
37-
---
38-
default: `true`
39-
---
40-
If set to `true`, automatically generates `KSPAssemblyDependency` attributes for each dependency. Dependencies should have either the `CKANIdentifier` metadata or `KSPAssemblyName` metadata. Versions can be supplied with `CKANVersion` or `KSPAssemblyVersion`.
41-
```
42-
4329
```{confval} KSPBT_ReferenceSystemAssemblies
4430
---
4531
default: `true`
@@ -56,21 +42,134 @@ If set to `true`, adds assembly references to all UnityEngine assemblies in the
5642

5743
```{confval} KSPBT_ReferenceGameAssemblies
5844
---
59-
default: `true`
45+
default: `true`, except in the `Unity` configuration
6046
---
6147
If set to `true`, adds references to Assembly-CSharp and Assembly-CSharp-firstpass assemblies from the KSP install.
6248
```
6349

6450
```{confval} KSPBT_ReferenceModAssemblies
6551
---
66-
default: `true`
52+
default: `true`, except in the `Unity` configuration
6753
---
6854
If set to `true`, adds references to the assemblies included in `ModReference` list.
6955
```
7056

57+
```{confval} KSPBT_GenerateAssemblyAttribute
58+
---
59+
default: `true`, except in the `Unity` configuration
60+
---
61+
If set to `true`, automatically generates the `KSPAssembly` for your assembly from the `Version` property.
62+
```
63+
64+
```{confval} KSPBT_GenerateDependencyAttributes
65+
---
66+
default: `true`, except in the `Unity` configuration
67+
---
68+
If set to `true`, automatically generates `KSPAssemblyDependency` attributes for each dependency. Dependencies should have either the `CKANIdentifier` metadata or `KSPAssemblyName` metadata. Versions can be supplied with `CKANVersion` or `KSPAssemblyVersion`.
69+
```
70+
71+
```{confval} KSPBT_CopyDLLsToPluginFolder
72+
---
73+
default: `true`, except in the `Unity` configuration
74+
---
75+
If set to `true`, automatically copies the compiled DLL to the {confval}`KSPBT_ModPluginFolder`.
76+
```
77+
78+
```{confval} KSPBT_GenerateVersionFile
79+
---
80+
default: `true`, except in the `Unity` configuration
81+
---
82+
If set to `true`, automatically generates a version file using the information in any {confval}`KSPVersionFile` items. Without defining a {confval}`KSPVersionFile`, nothing will be generated. See [](generating-version-files.md/) for more details.
83+
```
84+
7185
````{confval} KSPBT_GameRoot
7286
```{warning}
7387
You should **not** set or use this property in your csproj file.
7488
```
7589
This property should be set to the root directory of your KSP install. see [Locating your KSP Install](getting-started.md/#locating-your-ksp-install)
7690
````
91+
92+
## Items
93+
94+
````{confval} ModReference
95+
A reference to another mod that is a dependency. This mod will be automatically referenced in the build process and installed using CKAN if an identifier is given. See [](dependencies.md) for examples.
96+
97+
```{rubric} Metadata
98+
```
99+
100+
```{describe} Identity
101+
The name of the mod you are referencing, as set in that mod's `KSPAssemblyAttribute`
102+
```
103+
104+
```{describe} DLLPath
105+
The path of the mod's assembly to reference when building, relative to {confval}`KSPBT_GameRoot`.
106+
```
107+
108+
```{describe} CKANIdentifier
109+
The name of the mod in CKAN to install before building.
110+
```
111+
112+
```{describe} CKANVersion
113+
The specific version to install from CKAN, if any.
114+
```
115+
116+
Any additional metadata is copied to the resulting [`Reference`](https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-items?view=vs-2022#reference) item
117+
````
118+
119+
````{confval} KSPVersionFile
120+
Defines a version file to generate. See [](generating-version-files.md) for examples.
121+
122+
```{rubric} Metadata
123+
```
124+
125+
```{describe} Identity
126+
To create a new version file from scratch, set to `.`. Otherwise set to a path to a json version file to use as a base
127+
```
128+
```{describe} Destination
129+
Path to where the generated json version file should be placed
130+
```
131+
132+
```{confval} Name
133+
---
134+
default: `$(ProjectName)`
135+
---
136+
The mod name. Corresponds to the `NAME` value in json.
137+
```
138+
139+
```{confval} Version
140+
---
141+
default: `$(FileVersion)`
142+
---
143+
The mod version. Corresponds with the `VERSION` value in json.
144+
```
145+
146+
```{describe} URL
147+
The URL of the remote version file. Corresponds with the `URL` value in json.
148+
```
149+
150+
```{describe} Download
151+
Where to link players to update your mod. Corresponds with the `DOWNLOAD` value in json.
152+
```
153+
154+
```{confval} KSP_Version
155+
---
156+
default: `1.12`
157+
---
158+
The KSP version the mod is targeting. Corresponds with the `KSP_VERSION` value in json.
159+
```
160+
161+
```{confval} KSP_Version_Min
162+
---
163+
default: `1.8`
164+
---
165+
The minimum supported KSP version. Corresponds with the `KSP_VERSION_MIN` value in json.
166+
```
167+
168+
```{confval} KSP_Version_Max
169+
---
170+
default: `1.12`
171+
---
172+
The maximum supported KSP version. Corresponds with the `KSP_VERSION_MAX` value in json.
173+
```
174+
175+
````

docs/msbuild/dependencies.md

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,31 @@ KSPBuildTools can help manage other mods that you depend on
44

55
## Referencing Dependency DLLs
66

7-
Mod DLLs should be referenced as with any other DLLs, like so. See [the Microsoft docs on Reference items](https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-items?view=vs-2022#reference) for more info. Make sure that `<Private>False</Private>`{l=xml} is set or the DLL will be copied to your output directory.
7+
Mod DLLs should be referenced with the {confval}`ModReference` item, like so.
88

9-
the {confval}`KSPBT_GameRoot` property can be used to reference the KSP install wherever it is.
109
```xml
1110
<ItemGroup>
1211
<!-- Depends on Modulemanager and Harmony -->
13-
<Reference Include="$(KSPBT_GameRoot)/Modulemanager*.dll">
14-
<Private>False</Private>
15-
</Reference>
16-
<Reference Include="0Harmony, Culture=neutral, PublicKeyToken=null">
17-
<HintPath>$(KSPBT_GameRoot)/GameData/000_Harmony/0Harmony.dll</HintPath>
18-
<Private>False</Private>
19-
</Reference>
12+
<ModReference Include="Modulemanager">
13+
<DLLPath>GameData/Modulemanager*.dll</DLLPath>
14+
</ModReference>
15+
<ModReference Include="0Harmony">
16+
<DLLPath>GameData/000_Harmony/0Harmony.dll</DLLPath>
17+
</ModReference>
2018
</ItemGroup>
2119
```
2220

2321
## Installing Dependencies Automatically
2422

25-
KSPBuildTools can install CKAN mods automatically when built. This is useful for CI workflows such as those using the {gha:action}`compile` action, or to make it easier for others to compile your mod themselves. Either add the `<CKANIdentifier>` metadata to your `<Reference>` items, or if the dependency mod doesn't have a dll you need to reference you can use the `<CKANDependency>` item.
23+
KSPBuildTools can install CKAN mods automatically when built. This is useful for CI workflows such as those using the {gha:action}`compile` action, or to make it easier for others to compile your mod themselves. Either add the `<CKANIdentifier>` metadata to your `<ModReference>` items, or if the dependency mod doesn't have a dll you need to reference you can use the `<CKANDependency>` item.
2624

2725
```xml
2826
<ItemGroup>
2927
<!-- Depends on Modulemanager -->
30-
<Reference Include="$(KSPBT_GameRoot)/Modulemanager*.dll">
31-
<Private>False</Private>
28+
<ModReference Include="Modulemanager">
29+
<DLLPath>GameData/Modulemanager*.dll</DLLPath>
3230
<CKANIdentifier>ModuleManager</CKANIdentifier>
33-
</Reference>
31+
</ModReference>
3432

3533
<!-- Also depends on Tantares SP, which doesn't have a plugin -->
3634
<CKANDependency Include="TantaresSP"/>
@@ -42,11 +40,11 @@ You can also mark explicit versions to install.
4240
```xml
4341
<ItemGroup>
4442
<!-- Depends on Modulemanager 4.2.3 ONLY -->
45-
<Reference Include="$(KSPBT_GameRoot)/Modulemanager*.dll">
46-
<Private>False</Private>
43+
<ModReference Include="Modulemanager">
44+
<DLLPath>GameData/Modulemanager*.dll</DLLPath>
4745
<CKANIdentifier>ModuleManager</CKANIdentifier>
4846
<CKANVersion>4.2.3</CKANVersion>
49-
</Reference>
47+
</ModReference>
5048

5149
<!-- Also depends on Tantares SP, which doesn't have a plugin -->
5250
<CKANDependency Include="TantaresSP==6.0"/>
@@ -59,26 +57,19 @@ KSP mods should mark their dependency DLLs using the `KSPAssemblyDependency` att
5957

6058
`[assembly: KSPAssemblyDependency("0Harmony", 0, 0, 0)]`{l=csharp}
6159

62-
If the {confval}`KSPBT_GenerateDependencyAttributes` property is set to `true`, KSPBuildTools will generate these attributes automatically. It uses any `Reference` item that has a `<CKANIdentifier>` or `<KSPAssemblyName>` metadata value.
60+
If the {confval}`KSPBT_GenerateDependencyAttributes` property is set to `true` (the default), KSPBuildTools will generate these attributes automatically.
6361

64-
The assembly name is set to the `<KSPAssemblyName>` metadata value, and falls back to the `<CKANIdentifier>` metadata value.
62+
The assembly name is taken from the value of the item.
6563

6664
The version is taken from the `<KSPAssemblyVersion>` metadata value, however leaving it at the default of 0.0.0 is usually acceptable
6765

6866
```xml
6967
<ItemGroup>
7068
<!-- Depends on Tweakscale -->
71-
<Reference Include="$(KSPBT_GameRoot)/GameData/TweakScale/plugins/Scale.dll">
72-
<Private>False</Private>
69+
<Reference Include="Scale">
70+
<DLLPath>GameData/TweakScale/plugins/Scale.dll</DLLPath>
7371
<CKANIdentifier>TweakScaleRescaled</CKANIdentifier>
74-
<KSPAssemblyName>Scale</KSPAssemblyName>
7572
<KSPAssemblyVersion>3.2.0</KSPAssemblyVersion>
7673
</Reference>
7774
</ItemGroup>
78-
79-
<PropertyGroup>
80-
<!-- Generate assembly attributes -->
81-
<KSPBT_GenerateAssemblyAttribute>true</KSPBT_GenerateAssemblyAttribute>
82-
<KSPBT_GenerateDependencyAttributes>true</KSPBT_GenerateDependencyAttributes>
83-
</PropertyGroup>
8475
```

0 commit comments

Comments
 (0)