diff --git a/.github/actions/compile/action.yml b/.github/actions/compile/action.yml index d8c70dc..b86da49 100644 --- a/.github/actions/compile/action.yml +++ b/.github/actions/compile/action.yml @@ -76,5 +76,5 @@ runs: working-directory: ${{ inputs.working-directory }} run: | dotnet msbuild -p:Configuration=${{ inputs.build-configuration }} \ - -p:ManagedRelativePath=KSP_x64_Data/Managed ${{ inputs.solution-file-path }} \ - ${{ runner.debug && '-v:detailed' }} + -p:KSPBT_ManagedRelativePath=KSP_x64_Data/Managed ${{ inputs.solution-file-path }} \ + ${{ runner.debug && '-v:diagnostic' }} diff --git a/.github/workflows/internal-test-plugin-nuget.yml b/.github/workflows/internal-test-plugin-nuget.yml index 9519ca2..d3dbbc5 100644 --- a/.github/workflows/internal-test-plugin-nuget.yml +++ b/.github/workflows/internal-test-plugin-nuget.yml @@ -13,7 +13,11 @@ env: NuGetDirectory: ${{ github.workspace}}/nuget jobs: + build: + strategy: + matrix: + dotnet-version: [ 5.x, 7.x, 9.x ] runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -39,11 +43,12 @@ jobs: with: ksp-zip-url: https://github.com/KSPModdingLibs/KSPLibs/raw/main/KSP-1.12.5.zip working-directory: ${{ env.TESTDIR }} - solution-file-path: plugin-mod.csproj + solution-file-path: plugin-mod-nuget.csproj + dotnet-version: ${{ matrix.dotnet-version }} env: KSPBuildToolsVersion: ${{ inputs.package-version }} - uses: ./.github/actions/assemble-release with: artifacts: ${{ env.TESTDIR }}/GameData - output-file-name: plugin-mod-nuget + output-file-name: plugin-mod-nuget-${{ matrix.dotnet-version }} diff --git a/.gitignore b/.gitignore index 6851198..8842667 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,12 @@ bin obj *.nupkg +packages # docs docs/_build + +# misc +.DS_Store +.idea +*.user diff --git a/CHANGELOG.md b/CHANGELOG.md index bd420c8..117803f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,25 @@ All notable changes to this project will be documented in this file +## Unreleased + +### Msbuild + +- Renamed global msbuild properties to have the `KSPBT_` prefix to avoid namespace collisions with other frameworks + - `KSPRoot` is now `KSPBT_GameRoot`. It should no longer be referenced within a .csproj file + - `RepoRootPath` is now `KSPBT_ModRoot`, and should now point to the mod folder within GameData rather than the + root of a git repo + - `BinariesOutputRelativePath` is now `KSPBT_ModPluginFolder` + - `GenerateKSPAssemblyAttribute` is now `KSPBT_GenerateAssemblyAttribute` and defaults to true + - `GenerateKSPAssemblyDependencyAttributes` is now `KSPBT_GenerateDependencyAttributes` and defaults to true + - `ReferenceUnityAssemblies` is now `KSPBT_ReferenceUnityAssemblies` + - `ReferenceKSPAssemblies` is now `KSPBT_ReferenceGameAssemblies` +- Added the `KSPBT_ReferenceSystemAssemblies` property to control referencing the mono system DLLs within the KSP + managed folder. Setting this property to false will load the implicit framework DLLs instead. +- Mod dependencies should now be declared with + `ModReference` items. This avoids the need for the KSP install path to be known at evaluation time. + + ## 0.0.4 - 2025-06-15 ### Library diff --git a/KSPBuildTools.csproj b/KSPBuildTools.csproj index aa6d9f9..56d4565 100644 --- a/KSPBuildTools.csproj +++ b/KSPBuildTools.csproj @@ -24,7 +24,7 @@ 1701;1702;CS0649;CS1591;NU5128 2024 KSPModdingLibs Contributors KSPBuildTools - $(ProjectDir) + $(ProjectDir) KSPBuildTools README.md KSP Build Tools diff --git a/KSPBuildTools.sln b/KSPBuildTools.sln new file mode 100644 index 0000000..5b01e79 --- /dev/null +++ b/KSPBuildTools.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KSPBuildTools", "KSPBuildTools.csproj", "{F5D90A2D-BF85-4849-9A1B-AD53EE814149}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "plugin-mod-legacy", "tests\plugin-mod-legacy\PluginModLegacy\plugin-mod-legacy.csproj", "{F19C7AB4-50C2-4378-9673-CC039CA12E10}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "plugin-mod-nuget", "tests\plugin-mod-nuget\plugin-mod-nuget.csproj", "{4F531716-DB82-4AD4-8270-DFB32EE18A41}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "plugin-mod", "tests\plugin-mod\plugin-mod.csproj", "{F0E30935-74A7-446F-A30C-5D1D0E525EC5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F5D90A2D-BF85-4849-9A1B-AD53EE814149}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F5D90A2D-BF85-4849-9A1B-AD53EE814149}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F5D90A2D-BF85-4849-9A1B-AD53EE814149}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F5D90A2D-BF85-4849-9A1B-AD53EE814149}.Release|Any CPU.Build.0 = Release|Any CPU + {F19C7AB4-50C2-4378-9673-CC039CA12E10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F19C7AB4-50C2-4378-9673-CC039CA12E10}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F19C7AB4-50C2-4378-9673-CC039CA12E10}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F19C7AB4-50C2-4378-9673-CC039CA12E10}.Release|Any CPU.Build.0 = Release|Any CPU + {4F531716-DB82-4AD4-8270-DFB32EE18A41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4F531716-DB82-4AD4-8270-DFB32EE18A41}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4F531716-DB82-4AD4-8270-DFB32EE18A41}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4F531716-DB82-4AD4-8270-DFB32EE18A41}.Release|Any CPU.Build.0 = Release|Any CPU + {F0E30935-74A7-446F-A30C-5D1D0E525EC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F0E30935-74A7-446F-A30C-5D1D0E525EC5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F0E30935-74A7-446F-A30C-5D1D0E525EC5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F0E30935-74A7-446F-A30C-5D1D0E525EC5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/KSPCommon.props b/KSPCommon.props index f9ce71c..4cbfe17 100644 --- a/KSPCommon.props +++ b/KSPCommon.props @@ -4,155 +4,92 @@ true - - - true - + + + + false + false - - - true - true - + + false - - - 1.12 1.11 1.10 1.9 1.8 - + + false + false - - - - KSP_x64_Data\Managed - KSP.app\Contents\Resources\Data\Managed - KSP_Data\Managed - - - KSP_x64.exe - KSP.app/Contents/MacOS/KSP - KSP.x86_64 - C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program - $(HOME)/Library/Application Support/Steam/steamapps/common/Kerbal Space Program + + false + + + false - - + - - $(SolutionDir.TrimEnd([System.IO.Path]::DirectorySeparatorChar)) - GameData/$(SolutionName) - + + $(MSBuildProjectDirectory)/../GameData/$(MSBuildProjectName)/ - - - + + - - - + + 1.12 1.11 1.10 1.9 1.8 - - + + true + true + true + true - - - $(ManagedRelativePath)/Assembly-CSharp.dll - property - + + true - - - - $(KSP_ROOT) - environment variable - - - - - - + + true + true - - - $(SolutionDir)KSP - solution directory - + + true - - - $(ReferencePath) - reference path + true - - - $(SteamKSPRoot) - steam - + + + + false + true + + + 1.12 + 1.8 + 1.12 + + - - - $(KSPRoot)/$(ManagedRelativePath) + + + KSP_x64_Data/Managed + KSP.app/Contents/Resources/Data/Managed + KSP_Data/Managed - - Program - $(KSPRoot)\$(KSPExecutable) - $(KSPRoot) - portable + <_KSPBT_GameExecutable Condition=" $([MSBuild]::IsOsPlatform('Windows')) ">KSP_x64.exe + <_KSPBT_GameExecutable Condition=" $([MSBuild]::IsOsPlatform('OSX')) ">KSP.app/Contents/MacOS/KSP + <_KSPBT_GameExecutable Condition=" $([MSBuild]::IsOsPlatform('Linux')) ">KSP.x86_64 + <_KSPBT_SteamGameRoot Condition=" $([MSBuild]::IsOsPlatform('Windows')) ">C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program + <_KSPBT_SteamGameRoot Condition=" $([MSBuild]::IsOsPlatform('OSX')) ">$(HOME)/Library/Application Support/Steam/steamapps/common/Kerbal Space Program - - - - true - - true - - false - $(ManagedPath) - + + + - - - - System (KSP/Mono) - False - - - System (KSP/Mono) - False - - - System.Core (KSP/Mono) - False - - - System.Xml (KSP/Mono) - False - - - - - UnityEngine - False - - - - - Assembly-CSharp - False - - - Assembly-CSharp-firstpass - False - - + + - + diff --git a/KSPCommon.targets b/KSPCommon.targets index fdc4607..257da3c 100644 --- a/KSPCommon.targets +++ b/KSPCommon.targets @@ -2,91 +2,187 @@ - + + + $(KSPBT_ManagedRelativePath)/Assembly-CSharp.dll + property + + + + + + $(KSP_ROOT) + environment variable + - - + + + - + + + $(SolutionDir)KSP + solution directory + - - + $(ReferencePath) + reference path + + + + + $(_KSPBT_SteamGameRoot) + steam + + + + + Program + $(KSPBT_GameRoot)/$(_KSPBT_GameExecutable) + $(KSPBT_GameRoot) + portable + + + + + + $(KSPBT_GameRoot)/$(KSPBT_ManagedRelativePath) + + + + + + true + + true + + false + true + $(KSPBT_ManagedPath) + <_FullFrameworkReferenceAssemblyPaths>$(KSPBT_ManagedPath) + <_TargetFrameworkDirectories>$(KSPBT_ManagedPath) + + + + + + System (KSP/Mono) + False + + + System (KSP/Mono) + False + + + System.Core (KSP/Mono) + False + + + System.Xml (KSP/Mono) + False + + + + + UnityEngine + False + + + + + Assembly-CSharp + False + + + Assembly-CSharp-firstpass + False + + + + + + + Condition="'$(KSPBT_GameRoot)' == ''"/> - <_KSPRootMessage Include="KSPRoot Candidates:"/> - <_KSPRootMessage Include="Candidate: %(KSPRootCandidate.source) from %(KSPRootCandidate.identity)"/> - <_KSPRootMessage Include="Chosen KSPRoot: $(KSPRoot) in $(KSPRootSource)" Condition="'$(KSPRoot)' != ''"/> + <_GameRootMessage Include="KSPBT_GameRoot Candidates:"/> + <_GameRootMessage Include="Candidate: %(KSPBT_GameRootCandidate.source) from %(KSPBT_GameRootCandidate.identity)"/> + <_GameRootMessage Include="Chosen KSPBT_GameRoot: $(KSPBT_GameRoot) in $(KSPBT_GameRootSource)" Condition="'$(KSPBT_GameRoot)' != ''"/> - - + - - + + + KSPBT_ReferenceModAssemblies;$(ResolveAssemblyReferencesDependsOn) + KSPBT_ReferenceModAssemblies;$(KSPBT_GenerateCKANScriptDependsOn) + + - + + %(ModReference.identity) + - - - + + + - $(BaseIntermediateOutputPath)ckancommands.cache + <_CKANScript>$(BaseIntermediateOutputPath)ckancommands.cache - + - <_CKANCompatibleVersionItems Include="$(CKANCompatibleVersions.Split(' '))"/> + <_CKANCompatibleVersionItems Include="$(KSPBT_CKANCompatibleVersions.Split(' '))"/> <_CKANDependency Include="%(Reference.CKANIdentifier)" Condition="'%(Reference.CKANVersion)' == ''"/> <_CKANDependency Include="%(Reference.CKANIdentifier)=%(Reference.CKANVersion)" Condition="'%(Reference.CKANVersion)' != ''"/> <_CKANDependency Include="@(CKANDependency)"/> - @(_CKANDependency, ' ') + <_CKANDependencyList>@(_CKANDependency, ' ') - <_CKANCommands Include="compat add --gamedir "$(KSPROOT)" %(_CKANCompatibleVersionItems.Identity)" - Condition=" '$(CKANCompatibleVersions)' != '' "/> + <_CKANCommands Include="compat add --gamedir "$(KSPBT_GameRoot)" %(_CKANCompatibleVersionItems.Identity)" + Condition=" '$(KSPBT_CKANCompatibleVersions)' != '' "/> - <_CKANCommands Include="install --no-recommends --gamedir "$(KSPROOT)" $(CKANDependencyList)" Condition="'$(CKANDependencyList)' != ''"/> + <_CKANCommands Include="install --no-recommends --gamedir "$(KSPBT_GameRoot)" $(_CKANDependencyList)" Condition="'$(CKANDependencyList)' != ''"/> - + - + - - - - - - - - - - + + KSPBT_InstallCKANDependencies;$(ResolveAssemblyReferencesDependsOn) + + + - - - - - - - + + - - + + <_Parameter1>$(AssemblyName) @@ -109,10 +205,10 @@ Otherwise CKANVersion is used. Otherwise 0.0 is used (no minimum version) --> - + - + $([System.String]::Copy('%(Reference.identity)').Split(',')[0]) %(Reference.CKANVersion) 0.0 @@ -147,16 +243,12 @@ - - - 1.12 - 1.8 - 1.12 - - + - + $(ProjectName) @@ -196,4 +288,15 @@ + + + + + <_BinariesToCopy Include="$(TargetDir)/**/*.dll"/> + <_BinariesToCopy Include="$(TargetDir)/**/*.pdb" Condition="'$(Condition)' == 'Debug'"/> + + + + diff --git a/docs/msbuild/configuration.md b/docs/msbuild/configuration.md new file mode 100644 index 0000000..9626663 --- /dev/null +++ b/docs/msbuild/configuration.md @@ -0,0 +1,175 @@ +# Configuration + +## Properties + +```{confval} KSPBT_ModRoot +--- +default: `$(MSBuildProjectDir)/../GameData/$(MSBuildProjectName)/` +--- + +specifies the root directory of your mod (the folder that gets placed into GameData). Generally you'll want to set this to be relative to the csproj file using `$(MSBuildThisFileDirectory)`. +``` + +```{confval} KSPBT_ModPluginFolder +--- +default: `./` +--- + +the directory where compiled binaries should be copied. This is relative to the {confval}`KSPBT_ModRoot`. The DLLs will be copied to this directory after each build. +``` + +```{confval} KSPBT_CKANCompatibleVersions +--- +default: `1.12 1.11 1.10 1.9 1.8` +--- + +Used by the `CKANInstall` target to set additional KSP versions to treat as compatible when installing +``` + +```{confval} KSPBT_ReferenceSystemAssemblies +--- +default: `true` +--- +If set to `true`, adds assembly references to Mono System DLLs. +``` + +```{confval} KSPBT_ReferenceUnityAssemblies +--- +default: `true` +--- +If set to `true`, adds assembly references to all UnityEngine assemblies in the KSP install. +``` + +```{confval} KSPBT_ReferenceGameAssemblies +--- +default: `true`, except in the `Unity` configuration +--- +If set to `true`, adds references to Assembly-CSharp and Assembly-CSharp-firstpass assemblies from the KSP install. +``` + +```{confval} KSPBT_ReferenceModAssemblies +--- +default: `true`, except in the `Unity` configuration +--- +If set to `true`, adds references to the assemblies included in `ModReference` list. +``` + +```{confval} KSPBT_GenerateAssemblyAttribute +--- +default: `true`, except in the `Unity` configuration +--- +If set to `true`, automatically generates the `KSPAssembly` for your assembly from the `Version` property. +``` + +```{confval} KSPBT_GenerateDependencyAttributes +--- +default: `true`, except in the `Unity` configuration +--- +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`. +``` + +```{confval} KSPBT_CopyDLLsToPluginFolder +--- +default: `true`, except in the `Unity` configuration +--- +If set to `true`, automatically copies the compiled DLL to the {confval}`KSPBT_ModPluginFolder`. +``` + +```{confval} KSPBT_GenerateVersionFile +--- +default: `true`, except in the `Unity` configuration +--- +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. +``` + +````{confval} KSPBT_GameRoot +```{warning} +You should **not** set or use this property in your csproj file. +``` +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) +```` + +## Items + +````{confval} ModReference +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. + +```{rubric} Metadata +``` + +```{describe} Identity +The name of the mod you are referencing, as set in that mod's `KSPAssemblyAttribute` +``` + +```{describe} DLLPath +The path of the mod's assembly to reference when building, relative to {confval}`KSPBT_GameRoot`. +``` + +```{describe} CKANIdentifier +The name of the mod in CKAN to install before building. +``` + +```{describe} CKANVersion +The specific version to install from CKAN, if any. +``` + +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 +```` + +````{confval} KSPVersionFile +Defines a version file to generate. See [](generating-version-files.md) for examples. + +```{rubric} Metadata +``` + +```{describe} Identity +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 +``` +```{describe} Destination +Path to where the generated json version file should be placed +``` + +```{confval} Name +--- +default: `$(ProjectName)` +--- +The mod name. Corresponds to the `NAME` value in json. +``` + +```{confval} Version +--- +default: `$(FileVersion)` +--- +The mod version. Corresponds with the `VERSION` value in json. +``` + +```{describe} URL +The URL of the remote version file. Corresponds with the `URL` value in json. +``` + +```{describe} Download +Where to link players to update your mod. Corresponds with the `DOWNLOAD` value in json. +``` + +```{confval} KSP_Version +--- +default: `1.12` +--- +The KSP version the mod is targeting. Corresponds with the `KSP_VERSION` value in json. +``` + +```{confval} KSP_Version_Min +--- +default: `1.8` +--- +The minimum supported KSP version. Corresponds with the `KSP_VERSION_MIN` value in json. +``` + +```{confval} KSP_Version_Max +--- +default: `1.12` +--- +The maximum supported KSP version. Corresponds with the `KSP_VERSION_MAX` value in json. +``` + +```` diff --git a/docs/msbuild/dependencies.md b/docs/msbuild/dependencies.md index 9ef01ea..064c723 100644 --- a/docs/msbuild/dependencies.md +++ b/docs/msbuild/dependencies.md @@ -4,33 +4,31 @@ KSPBuildTools can help manage other mods that you depend on ## Referencing Dependency DLLs -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 `False`{l=xml} is set or the DLL will be copied to your output directory. +Mod DLLs should be referenced with the {confval}`ModReference` item, like so. -the {confval}`KSPRoot` property can be used to reference the KSP install wherever it is. ```xml - - False - - - $(KSPRoot)/GameData/000_Harmony/0Harmony.dll - False - + + GameData/Modulemanager*.dll + + + GameData/000_Harmony/0Harmony.dll + ``` ## Installing Dependencies Automatically -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 `` metadata to your `` items, or if the dependency mod doesn't have a dll you need to reference you can use the `` item. +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 `` metadata to your `` items, or if the dependency mod doesn't have a dll you need to reference you can use the `` item. ```xml - - False + + GameData/Modulemanager*.dll ModuleManager - + @@ -42,11 +40,11 @@ You can also mark explicit versions to install. ```xml - - False + + GameData/Modulemanager*.dll ModuleManager 4.2.3 - + @@ -59,26 +57,32 @@ KSP mods should mark their dependency DLLs using the `KSPAssemblyDependency` att `[assembly: KSPAssemblyDependency("0Harmony", 0, 0, 0)]`{l=csharp} -If the {confval}`GenerateKSPAssemblyDependencyAttributes` property is set to `true`, KSPBuildTools will generate these attributes automatically. It uses any `Reference` item that has a `` or `` metadata value. +If the {confval}`KSPBT_GenerateDependencyAttributes` property is set to `true` (the default), KSPBuildTools will generate these attributes automatically. -The assembly name is set to the `` metadata value, and falls back to the `` metadata value. +The assembly name is taken from the value of the item. The version is taken from the `` metadata value, however leaving it at the default of 0.0.0 is usually acceptable ```xml - - False + + GameData/TweakScale/plugins/Scale.dll TweakScaleRescaled - Scale 3.2.0 - + +``` + +To disable generating the `KSPAssemblyDependency` attribute for a single dependency (for example, if it lacks the `KSPAssembly` attribute), you can set `GenerateDependencyAttribute` to false - - - true - true - +```xml + + + + GameData/TweakScale/plugins/Scale.dll + TweakScaleRescaled + false + + ``` \ No newline at end of file diff --git a/docs/msbuild/generating-version-files.md b/docs/msbuild/generating-version-files.md index 43e72c5..27d7839 100644 --- a/docs/msbuild/generating-version-files.md +++ b/docs/msbuild/generating-version-files.md @@ -8,7 +8,7 @@ To use, add the following to your csproj, filling in the URLs and paths for your - $(RepoRootPath)GameData/MyMod/mymod.version + $(KSPBT_ModRoot)/mymod.version https://github.com/username/repo/releases/latest/download/mymod.version https://github.com/username.repo/releases/latest @@ -44,7 +44,7 @@ The `include` value can also be set to a json file including any other values yo - $(RepoRootPath)GameData/MyMod/mymod.version + $(KSPBT_ModRoot)/mymod.version ``` \ No newline at end of file diff --git a/docs/msbuild/getting-started.md b/docs/msbuild/getting-started.md index 27ec814..31447d2 100644 --- a/docs/msbuild/getting-started.md +++ b/docs/msbuild/getting-started.md @@ -74,9 +74,9 @@ KSPBuildTools needs to know where you have KSP installed in order to reference t There are several options for this. KSPBuildTools will choose in the following order. Either [autodiscovery in the solution directory](#solution-directory) or [setting a reference path in a .user file](#environment-variable) are the recommended methods for most users. -### KSPRoot MSBuild Property +### KSPBT_GameRoot MSBuild Property -If the {confval}`KSPRoot` MSBuild property is already set, KSPBuildTools will use it as-is. This can be set in your .csproj.user file. +If the {confval}`KSPBT_GameRoot` MSBuild property is already set, KSPBuildTools will use it as-is. This can be set in your .csproj.user file. ### Environment Variable diff --git a/docs/msbuild/index.md b/docs/msbuild/index.md index 94911d4..04e5588 100644 --- a/docs/msbuild/index.md +++ b/docs/msbuild/index.md @@ -23,6 +23,6 @@ maxdepth: 1 getting-started generating-version-files dependencies -properties +configuration ``` diff --git a/docs/msbuild/properties.md b/docs/msbuild/properties.md deleted file mode 100644 index 97d35e2..0000000 --- a/docs/msbuild/properties.md +++ /dev/null @@ -1,51 +0,0 @@ -# MSBuild Properties - -```{confval} KSPRoot -This property should be set to the root directory of your KSP install. You should not set this in your csproj, see [Locating your KSP Install](getting-started.md/#locating-your-ksp-install) -``` - -```{confval} RepoRootPath ---- -default: `$(SolutionDir)` ---- - -specifies the root directory of your mod repository. Generally you'll want to set this to be relative to the csproj file using `$(MSBuildThisFileDirectory)`. -``` - -```{confval} BinariesOutputRelativePath ---- -default: `GameData/$(SolutionName)` ---- - -the directory where compiled binaries should be copied. This is relative to the `RepoRootPath`. The binaries will be copied to this directory after each build. -``` - -```{confval} CKANCompatibleVersions ---- -default: `1.12 1.11 1.10 1.9 1.8` ---- - -Used by the `CKANInstall` target to set additional KSP versions to treat as compatible when installing -``` - -```{confval} GenerateKSPAssemblyAttribute -If set to `true`, automatically generates the `KSPAssembly` for your assembly from the `Version` property. -``` - -```{confval} GenerateKSPAssemblyDependencyAttributes -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`. -``` - -```{confval} ReferenceUnityAssemblies ---- -default: `true` ---- -If set to `true`, adds assembly references to all UnityEngine assemblies in the KSP install. You can set this to `false` to opt out of this behavior if you want to create a pure C# assembly that does not depend on Unity. -``` - -```{confval} ReferenceKSPAssemblies ---- -default: `true` ---- -If set to `true`, adds references to Assembly-CSharp and Assembly-CSharp-firstpass assemblies from the KSP install. You can set this to `false` to opt out of this behavior. -``` diff --git a/tests/plugin-mod-legacy/PluginModLegacy/plugin-mod-legacy.csproj b/tests/plugin-mod-legacy/PluginModLegacy/plugin-mod-legacy.csproj index b269787..72bb719 100644 --- a/tests/plugin-mod-legacy/PluginModLegacy/plugin-mod-legacy.csproj +++ b/tests/plugin-mod-legacy/PluginModLegacy/plugin-mod-legacy.csproj @@ -50,10 +50,6 @@ prompt MinimumRecommendedRules.ruleset - - $(MSBuildThisFileDirectory)../ - GameData/plugin-mod-legacy - diff --git a/tests/plugin-mod-nuget/plugin-mod.csproj b/tests/plugin-mod-nuget/plugin-mod-nuget.csproj similarity index 66% rename from tests/plugin-mod-nuget/plugin-mod.csproj rename to tests/plugin-mod-nuget/plugin-mod-nuget.csproj index 68f03b2..021b63b 100644 --- a/tests/plugin-mod-nuget/plugin-mod.csproj +++ b/tests/plugin-mod-nuget/plugin-mod-nuget.csproj @@ -3,6 +3,7 @@ *-* + plugin-mod @@ -22,29 +23,23 @@ 1701;1702;CS0649;CS1591; 2024 KSPModdingLibs Contributors PluginModNuget - $(MSBuildThisFileDirectory) - GameData/plugin-mod-nuget + $(MSBuildThisFileDirectory)/GameData/$(MSBuildProjectName) - - $(KSPRoot)/GameData/000_Harmony/0Harmony.dll + + GameData/000_Harmony/0Harmony.dll Harmony2 2.2.1.0 False - + - $(RepoRootPath)$(BinariesOutputRelativePath)/plugin-mod-nuget.version + $(KSPBT_ModRoot)/plugin-mod-nuget.version - - - true - true - diff --git a/tests/plugin-mod/plugin-mod.csproj b/tests/plugin-mod/plugin-mod.csproj index 4a3cc0f..490ed3b 100644 --- a/tests/plugin-mod/plugin-mod.csproj +++ b/tests/plugin-mod/plugin-mod.csproj @@ -6,6 +6,10 @@ all runtime; build; native; contentfiles; analyzers + + all + runtime; build; native; contentfiles; analyzers + @@ -17,31 +21,24 @@ 1701;1702;CS0649;CS1591; 2024 KSPModdingLibs Contributors PluginMod - $(MSBuildThisFileDirectory) - GameData/plugin-mod + $(MSBuildThisFileDirectory)/GameData/$(MSBuildProjectName) - - $(KSPRoot)/GameData/000_Harmony/0Harmony.dll + + GameData/000_Harmony/0Harmony.dll Harmony2 2.2.1.0 - False - + - $(RepoRootPath)$(BinariesOutputRelativePath)/plugin-mod.version + $(KSPBT_ModRoot)/plugin-mod.version - - true - true - -