update to .NET 6

This commit is contained in:
Jesse Plamondon-Willard
2023-10-06 22:19:17 -04:00
parent affc86fdd7
commit fedcb6bd8a
28 changed files with 35 additions and 33 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ for folder in ${folders[@]}; do
for modName in ${bundleModNames[@]}; do
echo "Compiling $modName for $folder..."
echo "-------------------------------------------------"
dotnet publish src/SMAPI.Mods.$modName --configuration $buildConfig -v minimal --runtime "$runtime" -p:OS="$msbuildPlatformName" -p:GamePath="$gamePath" -p:CopyToGameFolder="false"
dotnet publish src/SMAPI.Mods.$modName --configuration $buildConfig -v minimal --runtime "$runtime" -p:OS="$msbuildPlatformName" -p:GamePath="$gamePath" -p:CopyToGameFolder="false" --self-contained false
echo ""
echo ""
done
+1 -1
View File
@@ -85,7 +85,7 @@ foreach ($folder in $folders) {
foreach ($modName in $bundleModNames) {
echo "Compiling $modName for $folder..."
echo "-------------------------------------------------"
dotnet publish src/SMAPI.Mods.$modName --configuration $buildConfig -v minimal --runtime "$runtime" -p:OS="$msbuildPlatformName" -p:GamePath="$gamePath" -p:CopyToGameFolder="false"
dotnet publish src/SMAPI.Mods.$modName --configuration $buildConfig -v minimal --runtime "$runtime" -p:OS="$msbuildPlatformName" -p:GamePath="$gamePath" -p:CopyToGameFolder="false" --self-contained false
echo ""
echo ""
}
+3
View File
@@ -11,6 +11,9 @@
* For players:
* Updated for Stardew Valley 1.6.
* For mod authors:
* Updated to .NET 6.
## Upcoming release
* For players:
* Added support for overriding SMAPI configuration per `Mods` folder (thanks to Shockah!).
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<RootNamespace>StardewModdingAPI.Installer</RootNamespace>
<Description>The SMAPI installer for players.</Description>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
@@ -1,10 +1,10 @@
{
"runtimeOptions": {
"tfm": "net5.0",
"tfm": "net6.0",
"includedFrameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "5.0.0",
"version": "6.0.0",
"rollForward": "latestMinor"
}
],
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
@@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyName>ConsoleCommands</AssemblyName>
<RootNamespace>StardewModdingAPI.Mods.ConsoleCommands</RootNamespace>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
@@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyName>ErrorHandler</AssemblyName>
<RootNamespace>StardewModdingAPI.Mods.ErrorHandler</RootNamespace>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
@@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyName>SaveBackup</AssemblyName>
<RootNamespace>StardewModdingAPI.Mods.SaveBackup</RootNamespace>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<Import Project="..\..\build\common.targets" />
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<Import Project="..\..\build\common.targets" />
+1 -1
View File
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<Import Project="..\..\build\common.targets" />
@@ -29,7 +29,7 @@ namespace StardewModdingAPI
** Accessors
*********/
/// <summary>Whether this is a prerelease version.</summary>
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[MemberNotNullWhen(true, nameof(ISemanticVersion.PrereleaseTag))]
#endif
bool IsPrerelease();
@@ -2,7 +2,7 @@
<PropertyGroup>
<RootNamespace>StardewModdingAPI</RootNamespace>
<Description>Provides toolkit interfaces which are available to SMAPI mods.</Description>
<TargetFrameworks>net5.0; netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0; netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
@@ -48,7 +48,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki
/// <summary>Apply the change descriptors to a comma-delimited field.</summary>
/// <param name="rawField">The raw field text.</param>
/// <returns>Returns the modified field.</returns>
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[return: NotNullIfNotNull("rawField")]
#endif
public string? ApplyToCopy(string? rawField)
@@ -51,7 +51,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki
public WikiCompatibilityInfo? BetaCompatibility { get; }
/// <summary>Whether a Stardew Valley or SMAPI beta which affects mod compatibility is in progress. If this is true, <see cref="BetaCompatibility"/> should be used for beta versions of SMAPI instead of <see cref="Compatibility"/>.</summary>
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[MemberNotNullWhen(true, nameof(WikiModEntry.BetaCompatibility))]
#endif
public bool HasBetaInfo => this.BetaCompatibility != null;
@@ -106,7 +106,7 @@ namespace StardewModdingAPI.Toolkit.Framework
/// <param name="index">The index of the next character to read.</param>
/// <param name="tag">The parsed tag.</param>
private static bool TryParseTag(char[] raw, ref int index,
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[NotNullWhen(true)]
#endif
out string? tag
@@ -22,7 +22,7 @@ namespace StardewModdingAPI.Toolkit.Framework.UpdateData
public string? Subkey { get; }
/// <summary>Whether the update key seems to be valid.</summary>
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[MemberNotNullWhen(true, nameof(UpdateKey.ID))]
#endif
public bool LooksValid { get; }
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<RootNamespace>StardewModdingAPI.Toolkit</RootNamespace>
<Description>A library which encapsulates mod-handling logic for mod managers and tools. Not intended for use by mods.</Description>
<TargetFrameworks>net5.0; netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0; netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
+3 -3
View File
@@ -119,7 +119,7 @@ namespace StardewModdingAPI.Toolkit
}
/// <inheritdoc />
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[MemberNotNullWhen(true, nameof(SemanticVersion.PrereleaseTag))]
#endif
public bool IsPrerelease()
@@ -202,7 +202,7 @@ namespace StardewModdingAPI.Toolkit
/// <param name="parsed">The parsed representation.</param>
/// <returns>Returns whether parsing the version succeeded.</returns>
public static bool TryParse(string? version,
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[NotNullWhen(true)]
#endif
out ISemanticVersion? parsed
@@ -217,7 +217,7 @@ namespace StardewModdingAPI.Toolkit
/// <param name="parsed">The parsed representation.</param>
/// <returns>Returns whether parsing the version succeeded.</returns>
public static bool TryParse(string? version, bool allowNonStandard,
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[NotNullWhen(true)]
#endif
out ISemanticVersion? parsed
@@ -44,7 +44,7 @@ namespace StardewModdingAPI.Toolkit.Serialization
/// <exception cref="ArgumentException">The given <paramref name="fullPath"/> is empty or invalid.</exception>
/// <exception cref="JsonReaderException">The file contains invalid JSON.</exception>
public bool ReadJsonFileIfExists<TModel>(string fullPath,
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[NotNullWhen(true)]
#endif
out TModel? result
@@ -117,7 +117,7 @@ namespace StardewModdingAPI.Toolkit.Serialization.Models
/// <summary>Normalize a manifest field to strip newlines, trim whitespace, and optionally strip square brackets.</summary>
/// <param name="input">The input to strip.</param>
/// <param name="replaceSquareBrackets">Whether to replace square brackets with round ones. This is used in the mod name to avoid breaking the log format.</param>
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[return: NotNullIfNotNull("input")]
#endif
private string? NormalizeField(string? input, bool replaceSquareBrackets = false)
@@ -33,7 +33,7 @@ namespace StardewModdingAPI.Toolkit.Serialization.Models
*********/
/// <summary>Normalize whitespace in a raw string.</summary>
/// <param name="input">The input to strip.</param>
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[return: NotNullIfNotNull("input")]
#endif
private string? NormalizeWhitespace(string? input)
@@ -54,7 +54,7 @@ namespace StardewModdingAPI.Toolkit.Serialization.Models
*********/
/// <summary>Normalize whitespace in a raw string.</summary>
/// <param name="input">The input to strip.</param>
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[return: NotNullIfNotNull("input")]
#endif
private string? NormalizeWhitespace(string? input)
+3 -3
View File
@@ -50,7 +50,7 @@ namespace StardewModdingAPI.Toolkit.Utilities
/// <summary>Normalize an asset name to match how MonoGame's content APIs would normalize and cache it.</summary>
/// <param name="assetName">The asset name to normalize.</param>
[Pure]
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[return: NotNullIfNotNull("assetName")]
#endif
public static string? NormalizeAssetName(string? assetName)
@@ -66,7 +66,7 @@ namespace StardewModdingAPI.Toolkit.Utilities
/// <param name="path">The file path to normalize.</param>
/// <remarks>This should only be used for file paths. For asset names, use <see cref="NormalizeAssetName"/> instead.</remarks>
[Pure]
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[return: NotNullIfNotNull("path")]
#endif
public static string? NormalizePath(string? path)
@@ -105,7 +105,7 @@ namespace StardewModdingAPI.Toolkit.Utilities
[Pure]
public static string GetRelativePath(string sourceDir, string targetPath)
{
#if NET5_0
#if NET6_0_OR_GREATER
return Path.GetRelativePath(sourceDir, targetPath);
#else
// NOTE:
+1 -2
View File
@@ -5,7 +5,6 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.ExceptionServices;
using System.Security;
using System.Text;
using System.Threading;
@@ -233,7 +232,7 @@ namespace StardewModdingAPI.Framework
}
/// <summary>Launch SMAPI.</summary>
[HandleProcessCorruptedStateExceptions, SecurityCritical] // let try..catch handle corrupted state exceptions
[SecurityCritical]
public void RunInteractively()
{
// initialize SMAPI
+1 -1
View File
@@ -3,7 +3,7 @@
<AssemblyName>StardewModdingAPI</AssemblyName>
<RootNamespace>StardewModdingAPI</RootNamespace>
<Description>The modding API for Stardew Valley.</Description>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<OutputType>Exe</OutputType>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
+1 -1
View File
@@ -85,7 +85,7 @@ namespace StardewModdingAPI
}
/// <inheritdoc />
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
[MemberNotNullWhen(true, nameof(SemanticVersion.PrereleaseTag))]
#endif
public bool IsPrerelease()