TShock icon indicating copy to clipboard operation
TShock copied to clipboard

Use global.json to control .NET SDK version

Open Arthri opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. Currently, the NuGet CI and OTAPI CI use different versions of the .NET SDK. This is not a problem right now but someone might forget to update them in the future. Additionally, introducing a global.json ensures everyone is on the same SDK version and mitigates build problems https://github.com/Pryaxis/TShock/blob/6e589ffaeed99fa1b1559a5aa18c375d04961fb3/.github/workflows/ci-otapi3.yml#L16 https://github.com/Pryaxis/TShock/blob/6e589ffaeed99fa1b1559a5aa18c375d04961fb3/.github/workflows/ci-otapi3.yml#L34 https://github.com/Pryaxis/TShock/blob/6e589ffaeed99fa1b1559a5aa18c375d04961fb3/.github/workflows/ci-otapi3-nuget.yml#L20

Describe the solution you'd like Introduce a global.json at the repository's top level. This file controls which version of the .NET SDK MSBuild uses, but setup-dotnet(action used to setup .NET in CI) also supports it(in this case the dotnet-version should be removed):

Usage

See action.yml

Basic:

steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
  with:
    dotnet-version: '3.1.x'
- run: dotnet build <my project>

Warning: Unless a concrete version is specified in the global.json file, the latest .NET version installed on the runner (including preinstalled versions) will be used by default. Please refer to the documentation for the currently preinstalled .NET SDK versions.

The example config below specifies 6.0.100 as the SDK version, but allows a leniency of any version under 6.0.*. 6.0.404 passes, but 6.1.100 or 7.0.101 doesn't

{
    "sdk": {
        "version": "6.0.100",
        "rollForward": "latestFeature"
    }
}

Describe alternatives you've considered none considered

Additional context none

Arthri avatar Dec 24 '22 11:12 Arthri

It should also be worth to implement the security patches that have been rolled out so far. Considering these patches range from remote code execution (112) to unintended privilege elevation (110), it should be quite important to keep up with them, even if they don't directly apply to the current codebase.

csmir avatar Dec 24 '22 12:12 csmir