Skip to content

Commit e682534

Browse files
authored
Switch to using dotnet msbuild, and fully prevent importation of external reference assemblies (#54)
1 parent 87c4c79 commit e682534

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

.github/actions/compile/action.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ inputs:
1010
default: Release
1111
description: The project configuration to build.
1212

13+
dotnet-version:
14+
default: 5.x
15+
description: Version of dotnet compiler to use. Defaults to 5.x.
16+
1317
ksp-zip-url:
1418
default: https://github.com/KSPModdingLibs/KSPLibs/raw/main/KSP-1.12.5.zip
1519
description: >
16-
A url for a zip file that contains the assemblies from the game to link against. This should either be stripped
20+
A url for a zip file that contains the assemblies from the game to link against. This should either be stripped
1721
so that it only contains public interfaces, or encrypted so that the libraries are not being redistributed unprotected.
1822
19-
Defaults to KSP 1.12.5 with stripped versions
23+
Defaults to KSP 1.12.5 with stripped versions
2024
of the libraries which should be suitable for most users. It does not require a password.
2125
2226
ksp-zip-password:
@@ -25,7 +29,7 @@ inputs:
2529
2630
solution-file-path:
2731
description: >
28-
The path to the solution file to build. Defaults to empty, which will invoke `msbuild` on the root directory of
32+
The path to the solution file to build. Defaults to empty, which will invoke `msbuild` on the root directory of
2933
the repo and builds any `*.sln` file it finds there.
3034
3135
working-directory:
@@ -54,7 +58,7 @@ runs:
5458
- name: Setup .NET
5559
uses: actions/setup-dotnet@v4
5660
with:
57-
dotnet-version: 5.x
61+
dotnet-version: ${{ inputs.dotnet-version }}
5862

5963
- name: Download KSP Libs
6064
shell: bash
@@ -71,6 +75,6 @@ runs:
7175
shell: bash
7276
working-directory: ${{ inputs.working-directory }}
7377
run: |
74-
msbuild -p:Configuration=${{ inputs.build-configuration }} \
78+
dotnet msbuild -p:Configuration=${{ inputs.build-configuration }} \
7579
-p:ManagedRelativePath=KSP_x64_Data/Managed ${{ inputs.solution-file-path }} \
7680
${{ runner.debug && '-v:detailed' }}

KSPCommon.props

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,18 @@
104104
<DebugType>portable</DebugType>
105105
</PropertyGroup>
106106

107+
<!-- Prevent the compiler from acquiring or referencing any external reference assemblies -->
108+
<PropertyGroup>
109+
<!-- Do not download the .NET Framework Target Pack NuGet package automatically -->
110+
<DisableTransitiveFrameworkReferenceDownloads>true</DisableTransitiveFrameworkReferenceDownloads>
111+
<!-- Instruct the compiler to not automatically reference mscorlib -->
112+
<NoStandardLib>true</NoStandardLib>
113+
<!-- Prevent the GetReferenceAssemblyPaths task in Microsoft.Common.CurrentVersion.targets
114+
from attempting to locate an external copy of the reference assemblies. -->
115+
<AutomaticallyUseReferenceAssemblyPackages>false</AutomaticallyUseReferenceAssemblyPackages>
116+
<FrameworkPathOverride>$(ManagedPath)</FrameworkPathOverride>
117+
</PropertyGroup>
118+
107119
<!--Import references-->
108120
<ItemGroup>
109121
<Reference Include="$(ManagedPath)\System.dll">

0 commit comments

Comments
 (0)