Update Newtonsoft.Json to 13.0.2 and .Net 7

This commit is contained in:
Wojciech Figat
2022-12-17 13:38:30 +01:00
parent 889eb7d846
commit 84a68c5977
10 changed files with 547 additions and 987 deletions

View File

@@ -276,7 +276,7 @@ namespace Flax.Build
args.Add("/fullpaths");
args.Add("/filealign:512");
#if USE_NETCORE
args.Add("/langversion:latest");
args.Add("/langversion:11.0");
args.Add("-nowarn:8632"); // Nullable
#else
args.Add("/langversion:7.3");

View File

@@ -49,13 +49,13 @@ namespace Flax.Deps.Dependencies
"Newtonsoft.Json.pdb",
"Newtonsoft.Json.xml",
};
var binFolder = Path.Combine(root, "Src", "Newtonsoft.Json", "bin", configuration, "net45");
var binFolder = Path.Combine(root, "Src", "Newtonsoft.Json", "bin", configuration, "net7.0");
// Get the source
CloneGitRepo(root, "https://github.com/FlaxEngine/Newtonsoft.Json.git");
// Default build
GitCheckout(root, "master");
GitCheckout(root, "flax-net70");
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, buildPlatform);
foreach (var platform in options.Platforms)
{
@@ -74,8 +74,8 @@ namespace Flax.Deps.Dependencies
}
}
// AOT build
GitCheckout(root, "aot");
// AOT build (disabled codegen)
Utilities.ReplaceInFile(Path.Combine(root, "Src", "Newtonsoft.Json", "Newtonsoft.Json.csproj"), "HAVE_RUNTIME_SERIALIZATION;", ";");
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, buildPlatform);
foreach (var platform in options.Platforms)
{

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
@@ -26,8 +26,11 @@
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="3.2" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0" />
<PackageReference Include="Mono.Cecil" Version="0.11.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0" />
<PackageReference Include="System.CodeDom" Version="6.0" />
<Reference Include="Newtonsoft.Json">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Source\Platforms\DotNet\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@@ -1,9 +1,5 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace Flax.Build.Projects.VisualStudio
@@ -87,6 +83,8 @@ namespace Flax.Build.Projects.VisualStudio
csProjectFileContent.AppendLine(" <AssemblyName>$(MSBuildProjectName).CSharp</AssemblyName>"); // For backwards compatibility, keep the filename same
csProjectFileContent.AppendLine(" <GenerateAssemblyInfo>false</GenerateAssemblyInfo>"); // Prevents AssemblyInfo.cs generation (causes duplicate attributes)
csProjectFileContent.AppendLine(" <EnableBaseIntermediateOutputPathMismatchWarning>false</EnableBaseIntermediateOutputPathMismatchWarning>");
csProjectFileContent.AppendLine(" <LangVersion>11.0</LangVersion>");
csProjectFileContent.AppendLine(" <FileAlignment>512</FileAlignment>");
csProjectFileContent.AppendLine(string.Format(" <OutDir>{0}</OutDir>", baseOutputDir)); // This needs to be set here to fix errors in VS
csProjectFileContent.AppendLine(string.Format(" <IntermediateOutputPath>{0}</IntermediateOutputPath>", baseIntermediateOutputPath)); // This needs to be set here to fix errors in VS
@@ -163,17 +161,6 @@ namespace Flax.Build.Projects.VisualStudio
csProjectFileContent.AppendLine(" </PropertyGroup>");
}
// Nuget Package References
// TODO: Support custom Nuget package references
csProjectFileContent.AppendLine(" <ItemGroup>");
csProjectFileContent.AppendLine(" <PackageReference Include=\"DotNetZip\" Version=\"1.16\" />");
csProjectFileContent.AppendLine(" <PackageReference Include=\"Microsoft.CodeAnalysis.CSharp\" Version=\"4.3\" />");
csProjectFileContent.AppendLine(" <PackageReference Include=\"Microsoft.VisualStudio.Setup.Configuration.Interop\" Version=\"3.2\" />");
csProjectFileContent.AppendLine(" <PackageReference Include=\"Microsoft.Windows.Compatibility\" Version=\"6.0\" />");
csProjectFileContent.AppendLine(" <PackageReference Include=\"Newtonsoft.Json\" Version=\"13.0\" />");
csProjectFileContent.AppendLine(" <PackageReference Include=\"System.CodeDom\" Version=\"6.0\" />");
csProjectFileContent.AppendLine(" </ItemGroup>");
// References
csProjectFileContent.AppendLine(" <ItemGroup>");