diff --git a/Source/Editor/Editor.Build.cs b/Source/Editor/Editor.Build.cs
index be94bb7b5..f743a7aa7 100644
--- a/Source/Editor/Editor.Build.cs
+++ b/Source/Editor/Editor.Build.cs
@@ -1,5 +1,6 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
+using System;
using System.Collections.Generic;
using System.IO;
using Flax.Build;
@@ -75,7 +76,9 @@ public class Editor : EditorModule
// Visual Studio integration
if (options.Platform.Target == TargetPlatform.Windows && Flax.Build.Platform.BuildTargetPlatform == TargetPlatform.Windows)
{
+#pragma warning disable CA1416
var path = Registry.GetValue("HKEY_CLASSES_ROOT\\TypeLib\\{80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}\\8.0\\0\\win32", null, null) as string;
+#pragma warning restore CA1416
if (path != null && File.Exists(path))
options.PrivateDefinitions.Add("USE_VISUAL_STUDIO_DTE");
}
diff --git a/Source/Engine/Scripting/DotNet/CoreCLR.h b/Source/Engine/Scripting/DotNet/CoreCLR.h
index d869beadc..b2dc29cbf 100644
--- a/Source/Engine/Scripting/DotNet/CoreCLR.h
+++ b/Source/Engine/Scripting/DotNet/CoreCLR.h
@@ -47,7 +47,7 @@ public:
static gchandle NewGCHandleWeakref(void* obj, bool track_resurrection);
static void* GetGCHandleTarget(const gchandle& gchandle);
static void FreeGCHandle(const gchandle& gchandle);
-
+
static bool HasCustomAttribute(void* klass, void* attribClass);
static bool HasCustomAttribute(void* klass);
static void* GetCustomAttribute(void* klass, void* attribClass);
diff --git a/Source/Platforms/DotNet/NUnit/build/nunit.framework.dll b/Source/Platforms/DotNet/NUnit/build/nunit.framework.dll
index 5c31bf1bc..4148f3c15 100644
--- a/Source/Platforms/DotNet/NUnit/build/nunit.framework.dll
+++ b/Source/Platforms/DotNet/NUnit/build/nunit.framework.dll
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:d41bf7061cf3ee4f7efafeafd9ca889ce0e4b476e36151ca5e023e22c0020768
-size 482816
+oid sha256:8209dde828b2fd6bb89afff760916208fb8c0c3d91732676c3213e46c94aade0
+size 486912
diff --git a/Source/ThirdParty/nethost/FlaxEngine.CSharp.runtimeconfig.json b/Source/ThirdParty/nethost/FlaxEngine.CSharp.runtimeconfig.json
index 9c7f14dd0..202425667 100644
--- a/Source/ThirdParty/nethost/FlaxEngine.CSharp.runtimeconfig.json
+++ b/Source/ThirdParty/nethost/FlaxEngine.CSharp.runtimeconfig.json
@@ -3,7 +3,7 @@
"tfm": "net7.0",
"framework": {
"name": "Microsoft.NETCore.App",
- "version": "7.0.0-rc.2.22472.3"
+ "version": "7.0.0"
}
}
-}
\ No newline at end of file
+}
diff --git a/Source/ThirdParty/nethost/nethost.Build.cs b/Source/ThirdParty/nethost/nethost.Build.cs
index de8fa2650..b69035185 100644
--- a/Source/ThirdParty/nethost/nethost.Build.cs
+++ b/Source/ThirdParty/nethost/nethost.Build.cs
@@ -1,11 +1,9 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
-using System.Collections.Generic;
using System.IO;
using System;
using Flax.Build;
using Flax.Build.NativeCpp;
-using Flax.Build.Platforms;
using Microsoft.Win32;
using System.Linq;
@@ -26,7 +24,6 @@ public class nethost : ThirdPartyModule
BinaryModuleName = "FlaxEngine";
}
- ///
private static Version ParseVersion(string version)
{
// Give precedence to final releases over release candidate / beta releases
@@ -49,62 +46,67 @@ public class nethost : ThirdPartyModule
string arch = "x64"; //options.Architecture == TargetArchitecture.x64 ? "x64" : "x86";
- string dotnetVersion;
+ string dotnetPath, dotnetVersion;
string appHostRuntimePath;
+ string os;
+ string[] dotnetVersions;
- // NOTE: nethost is bundled with SDK, not runtime. Should C# scripting have a hard requirement for SDK to be installed?
-
+ // Pick DotNet SDK
if (options.Platform.Target == TargetPlatform.Windows)
{
- string os = $"win-{arch}";
-
+ os = $"win-{arch}";
+#pragma warning disable CA1416
using RegistryKey baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
-
using RegistryKey hostKey = baseKey.OpenSubKey(@$"SOFTWARE\dotnet\Setup\InstalledVersions\{arch}\sharedhost");
- string dotnetPath = (string)hostKey.GetValue("Path");
-
+ dotnetPath = (string)hostKey.GetValue("Path");
using RegistryKey runtimeKey = baseKey.OpenSubKey(@$"SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\{arch}\sharedfx\Microsoft.NETCore.App");
- string[] versions = runtimeKey.GetValueNames();
-
- dotnetVersion = versions.OrderByDescending(x => ParseVersion(x)).FirstOrDefault();
-
- if (string.IsNullOrEmpty(dotnetPath))
- dotnetPath = Environment.GetEnvironmentVariable("DOTNET_ROOT");
-
- if (string.IsNullOrEmpty(dotnetPath) || string.IsNullOrEmpty(dotnetVersion))
- throw new Exception("Failed to find dotnet installation");
-
- int majorVersion = int.Parse(dotnetVersion.Substring(0, dotnetVersion.IndexOf(".")));
- if (majorVersion < 7)
- throw new Exception($"Unsupported dotnet version found, minimum version required is .NET 7 (found {dotnetVersion})");
-
- appHostRuntimePath = String.Format("{0}packs\\Microsoft.NETCore.App.Host.{1}\\{2}\\runtimes\\{1}\\native", dotnetPath, os, dotnetVersion);
- options.OutputFiles.Add(Path.Combine(appHostRuntimePath, "nethost.lib"));
- options.DependencyFiles.Add(Path.Combine(appHostRuntimePath, "nethost.dll"));
- options.PublicIncludePaths.Add(appHostRuntimePath);
+ dotnetVersions = runtimeKey.GetValueNames();
+#pragma warning restore CA1416
}
else if (options.Platform.Target == TargetPlatform.Linux)
{
// TODO: Support /etc/dotnet/install_location
- string dotnetPath = "/usr/share/dotnet/";
- string os = $"linux-{arch}";
-
- string[] versions = Directory.GetDirectories($"{dotnetPath}host/fxr/").Select(x => Path.GetFileName(x)).ToArray();
-
- dotnetVersion = versions.OrderByDescending(x => ParseVersion(x)).FirstOrDefault();
-
- int majorVersion = int.Parse(dotnetVersion.Substring(0, dotnetVersion.IndexOf(".")));
- if (majorVersion < 7)
- throw new Exception($"Unsupported dotnet version found, minimum version required is .NET 7 (found {dotnetVersion})");
-
- appHostRuntimePath = String.Format("{0}packs/Microsoft.NETCore.App.Host.{1}/{2}/runtimes/{1}/native", dotnetPath, os, dotnetVersion);
- options.OutputFiles.Add(Path.Combine(appHostRuntimePath, "libnethost.a"));
- options.DependencyFiles.Add(Path.Combine(appHostRuntimePath, "libnethost.so"));
- options.PublicIncludePaths.Add(appHostRuntimePath);
+ dotnetPath = "/usr/share/dotnet/";
+ os = $"linux-{arch}";
+ dotnetVersions = Directory.GetDirectories($"{dotnetPath}host/fxr/").Select(x => Path.GetFileName(x)).ToArray();
}
else
throw new InvalidPlatformException(options.Platform.Target);
+ // Pick SDK version
+ dotnetVersion = dotnetVersions.OrderByDescending(ParseVersion).FirstOrDefault();
+ if (string.IsNullOrEmpty(dotnetPath))
+ dotnetPath = Environment.GetEnvironmentVariable("DOTNET_ROOT");
+ if (string.IsNullOrEmpty(dotnetPath) || string.IsNullOrEmpty(dotnetVersion))
+ throw new Exception("Failed to find dotnet installation");
+ int majorVersion = int.Parse(dotnetVersion.Substring(0, dotnetVersion.IndexOf(".")));
+ if (majorVersion < 7)
+ throw new Exception($"Unsupported dotnet version found, minimum version required is .NET 7 (found {dotnetVersion})");
+
+ // Setup build configuration
+ switch (options.Platform.Target)
+ {
+ case TargetPlatform.Windows:
+ case TargetPlatform.XboxOne:
+ case TargetPlatform.XboxScarlett:
+ case TargetPlatform.UWP:
+ appHostRuntimePath = string.Format("{0}packs\\Microsoft.NETCore.App.Host.{1}\\{2}\\runtimes\\{1}\\native", dotnetPath, os, dotnetVersion);
+ options.OutputFiles.Add(Path.Combine(appHostRuntimePath, "nethost.lib"));
+ options.DependencyFiles.Add(Path.Combine(appHostRuntimePath, "nethost.dll"));
+ break;
+ case TargetPlatform.Linux:
+ case TargetPlatform.Android:
+ case TargetPlatform.Switch:
+ case TargetPlatform.PS4:
+ case TargetPlatform.PS5:
+ case TargetPlatform.Mac:
+ appHostRuntimePath = string.Format("{0}packs/Microsoft.NETCore.App.Host.{1}/{2}/runtimes/{1}/native", dotnetPath, os, dotnetVersion);
+ options.OutputFiles.Add(Path.Combine(appHostRuntimePath, "libnethost.a"));
+ options.DependencyFiles.Add(Path.Combine(appHostRuntimePath, "libnethost.so"));
+ break;
+ default:
+ throw new InvalidPlatformException(options.Platform.Target);
+ }
options.PublicIncludePaths.Add(appHostRuntimePath);
options.ScriptingAPI.Defines.Add("USE_NETCORE");
options.DependencyFiles.Add(Path.Combine(FolderPath, "FlaxEngine.CSharp.runtimeconfig.json"));
diff --git a/Source/Tools/Flax.Build.Tests/Flax.Build.Tests.Build.cs b/Source/Tools/Flax.Build.Tests/Flax.Build.Tests.Build.cs
index 4bbfdb95e..357904947 100644
--- a/Source/Tools/Flax.Build.Tests/Flax.Build.Tests.Build.cs
+++ b/Source/Tools/Flax.Build.Tests/Flax.Build.Tests.Build.cs
@@ -18,7 +18,7 @@ public class FlaxBuildTestsTarget : Target
{
base.Init();
- Type = TargetType.DotNet;
+ Type = TargetType.DotNetCore;
OutputType = TargetOutputType.Library;
Platforms = new[]
{
diff --git a/Source/Tools/Flax.Build.Tests/Flax.Build.Tests.csproj b/Source/Tools/Flax.Build.Tests/Flax.Build.Tests.csproj
index 866496e84..7e0d667bc 100644
--- a/Source/Tools/Flax.Build.Tests/Flax.Build.Tests.csproj
+++ b/Source/Tools/Flax.Build.Tests/Flax.Build.Tests.csproj
@@ -1,57 +1,37 @@
-
-
-
+
- Debug
- AnyCPU
{3FB235A6-ADFF-415E-92B8-E810DA981A02}
- Library
- Properties
- Flax.Build.Tests
- Flax.Build.Tests
- v4.5.2
- 7.3
- 512
{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
UnitTest
-
- true
-
-
-
-
- true
- full
- false
+ net7.0
+ 11.0
+ disable
+ annotations
..\..\..\Binaries\Tools\
+ false
+ false
+ USE_NETCORE;FLAX_ASSERTIONS
+ portable
+
+
+
..\..\..\Cache\Intermediate\Flax.Build.Tests\Debug
- TRACE;DEBUG;FLAX_ASSERTIONS
- prompt
- 4
- pdbonly
- true
- ..\..\..\Binaries\Tools\
..\..\..\Cache\Intermediate\Flax.Build.Tests\Release
- TRACE;FLAX_ASSERTIONS
- prompt
- 4
+
+
-
- False
- ..\..\..\Binaries\Tools\Flax.Build.exe
-
..\..\Platforms\DotNet\NUnit\build\nunit.framework.dll
-
-
-
+
-
-
-
\ No newline at end of file
+
+
+
+
+
diff --git a/Source/Tools/Flax.Build/Build/Assembler.cs b/Source/Tools/Flax.Build/Build/Assembler.cs
index 3930d25f1..938188d3f 100644
--- a/Source/Tools/Flax.Build/Build/Assembler.cs
+++ b/Source/Tools/Flax.Build/Build/Assembler.cs
@@ -1,10 +1,14 @@
-// Copyright (c) 2012-2020 Flax Engine. All rights reserved.
+// Copyright (c) 2012-2020 Flax Engine. All rights reserved.
-using Microsoft.CodeAnalysis;
+using System;
+using System.IO;
+using System.Text;
+using System.Linq;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.Loader;
-using System.Text;
+using System.Collections.Generic;
+using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.Text;
diff --git a/Source/Tools/Flax.Build/Build/Builder.Projects.cs b/Source/Tools/Flax.Build/Build/Builder.Projects.cs
index 6a7fe0b87..fa40d2e2f 100644
--- a/Source/Tools/Flax.Build/Build/Builder.Projects.cs
+++ b/Source/Tools/Flax.Build/Build/Builder.Projects.cs
@@ -468,7 +468,7 @@ namespace Flax.Build
ProjectName = rulesProjectName,
FilePath = null,
FolderPath = null,
- Type = TargetType.DotNet,
+ Type = TargetType.DotNetCore,
OutputType = TargetOutputType.Library,
Platforms = new[] { Platform.BuildPlatform.Target },
Configurations = new[] { TargetConfiguration.Debug },
diff --git a/Source/Tools/Flax.Build/Build/Builder.Rules.cs b/Source/Tools/Flax.Build/Build/Builder.Rules.cs
index 43666837d..b502909f5 100644
--- a/Source/Tools/Flax.Build/Build/Builder.Rules.cs
+++ b/Source/Tools/Flax.Build/Build/Builder.Rules.cs
@@ -189,7 +189,6 @@ namespace Flax.Build
using (new ProfileEventScope("CompileRules"))
{
var assembler = new Assembler(files, Path.Combine(Globals.Root, Configuration.IntermediateFolder, "BuilderRules.cache"));
- //var assembler = new Assembler(files);
assembly = assembler.Build();
}
diff --git a/Source/Tools/Flax.Build/Build/Target.cs b/Source/Tools/Flax.Build/Build/Target.cs
index 535217dc3..61e0083a7 100644
--- a/Source/Tools/Flax.Build/Build/Target.cs
+++ b/Source/Tools/Flax.Build/Build/Target.cs
@@ -1,8 +1,8 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
using System;
-using System.Collections.Generic;
using System.IO;
+using System.Collections.Generic;
using Flax.Build.Graph;
using Flax.Build.NativeCpp;
diff --git a/Source/Tools/Flax.Build/Deps/Downloader.cs b/Source/Tools/Flax.Build/Deps/Downloader.cs
index e1e80a2f0..bdcc1045b 100644
--- a/Source/Tools/Flax.Build/Deps/Downloader.cs
+++ b/Source/Tools/Flax.Build/Deps/Downloader.cs
@@ -1,6 +1,10 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
+using System;
+using System.IO;
using System.Net;
+using System.Net.Http;
+using System.Threading.Tasks;
using Flax.Build;
namespace Flax.Deps
diff --git a/Source/Tools/Flax.Build/Flax.Build.csproj b/Source/Tools/Flax.Build/Flax.Build.csproj
index 3aeb41ddc..fc6682836 100644
--- a/Source/Tools/Flax.Build/Flax.Build.csproj
+++ b/Source/Tools/Flax.Build/Flax.Build.csproj
@@ -1,15 +1,18 @@
-
+
Exe
net7.0
- enable
+ 11.0
+ disable
annotations
Debug;Release
..\..\..\Binaries\Tools
..\..\..\Binaries\Tools
false
true
+ false
USE_NETCORE
+ portable
False
none
true
@@ -32,5 +35,4 @@
..\..\..\Source\Platforms\DotNet\Newtonsoft.Json.dll
-
diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs
index 5b3c0f722..b69c39aa5 100644
--- a/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs
+++ b/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs
@@ -1,6 +1,10 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
+using System;
using System.Text;
+using System.Linq;
+using System.Collections.Generic;
+using System.IO;
namespace Flax.Build.Projects.VisualStudio
{
@@ -49,9 +53,6 @@ namespace Flax.Build.Projects.VisualStudio
csProjectFileContent.AppendLine("");
csProjectFileContent.AppendLine("");
- //csProjectFileContent.AppendLine(string.Format("", projectFileToolVersion));
- //csProjectFileContent.AppendLine(" ");
-
// Properties
csProjectFileContent.AppendLine(" ");
@@ -73,16 +74,17 @@ namespace Flax.Build.Projects.VisualStudio
var baseConfigurations = project.Configurations.Select(x => x.Name.Split('|')[0]).Distinct().ToArray();
csProjectFileContent.AppendLine(" net7.0");
- csProjectFileContent.AppendLine(" enable");
- csProjectFileContent.AppendLine(" disable");
+ csProjectFileContent.AppendLine(" disable");
+ csProjectFileContent.AppendLine(" annotations");
csProjectFileContent.AppendLine(string.Format(" {0}", string.Join(";", baseConfigurations)));
- csProjectFileContent.AppendLine(" false"); // ?
+ csProjectFileContent.AppendLine(" false");
csProjectFileContent.AppendLine(" true"); // Needed for Hostfxr
csProjectFileContent.AppendLine(" true"); // ?
- csProjectFileContent.AppendLine(" false"); // Prevents outputting the file under net7.0 subdirectory
- csProjectFileContent.AppendLine(" $(MSBuildProjectName).CSharp"); // For backwards compatibility, keep the filename same
- csProjectFileContent.AppendLine(" false"); // Prevents AssemblyInfo.cs generation (causes duplicate attributes)
+ csProjectFileContent.AppendLine(" false");
csProjectFileContent.AppendLine(" false");
+ csProjectFileContent.AppendLine(" false");
+ csProjectFileContent.AppendLine(string.Format(" {0}", project.BaseName));
+ csProjectFileContent.AppendLine(string.Format(" {0}.CSharp", project.BaseName));
csProjectFileContent.AppendLine(" 11.0");
csProjectFileContent.AppendLine(" 512");
csProjectFileContent.AppendLine(string.Format(" {0}", baseOutputDir)); // This needs to be set here to fix errors in VS
@@ -165,9 +167,10 @@ namespace Flax.Build.Projects.VisualStudio
csProjectFileContent.AppendLine(" ");
- foreach (var reference in project.CSharp.SystemReferences)
+ // Unused when using explicitly NetCore7 ?
+ //foreach (var reference in project.CSharp.SystemReferences)
{
- csProjectFileContent.AppendLine(string.Format(" ", reference));
+ //csProjectFileContent.AppendLine(string.Format(" ", reference));
}
foreach (var reference in project.CSharp.FileReferences)
@@ -232,7 +235,6 @@ namespace Flax.Build.Projects.VisualStudio
// End
- //csProjectFileContent.AppendLine(" ");
csProjectFileContent.AppendLine("");
if (defaultTarget.CustomExternalProjectFilePath == null)
diff --git a/Source/Tools/FlaxEngine.Tests/FlaxEngine.Tests.Build.cs b/Source/Tools/FlaxEngine.Tests/FlaxEngine.Tests.Build.cs
index c9b309592..36285cd28 100644
--- a/Source/Tools/FlaxEngine.Tests/FlaxEngine.Tests.Build.cs
+++ b/Source/Tools/FlaxEngine.Tests/FlaxEngine.Tests.Build.cs
@@ -18,7 +18,7 @@ public class FlaxEngineTestsTarget : Target
{
base.Init();
- Type = TargetType.DotNet;
+ Type = TargetType.DotNetCore;
OutputType = TargetOutputType.Library;
Platforms = new[]
{
diff --git a/Source/Tools/FlaxEngine.Tests/FlaxEngine.Tests.csproj b/Source/Tools/FlaxEngine.Tests/FlaxEngine.Tests.csproj
index 89426d3fd..66caa2167 100644
--- a/Source/Tools/FlaxEngine.Tests/FlaxEngine.Tests.csproj
+++ b/Source/Tools/FlaxEngine.Tests/FlaxEngine.Tests.csproj
@@ -1,80 +1,40 @@
-
-
-
+
- Debug
- AnyCPU
{4AAED6A2-38B1-4A31-AB04-9264A94A8ECA}
- Library
- Properties
- FlaxEngine.Tests
- FlaxEngine.Tests
- v4.5.2
- 7.3
- 512
{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
UnitTest
-
- true
-
-
-
-
- true
- full
- false
- ..\..\..\Binaries\Tools\
- ..\..\..\Cache\Intermediate\FlaxEngine.Tests\Debug
- TRACE;DEBUG;FLAX_ASSERTIONS
- prompt
- 4
+ net7.0
+ 11.0
+ disable
+ annotations
true
+ ..\..\..\Binaries\Tools\
+ false
+ false
+ USE_NETCORE;FLAX_ASSERTIONS
+
+
+
+ full
+ ..\..\..\Cache\Intermediate\FlaxEngine.Tests\Debug
pdbonly
- true
- ..\..\..\Binaries\Tools\
..\..\..\Cache\Intermediate\FlaxEngine.Tests\Release
- TRACE;FLAX_ASSERTIONS
- prompt
- 4
- true
+
+
+
..\..\Platforms\DotNet\NUnit\build\nunit.framework.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
- {ed088b51-41ac-403b-9b3e-91a38c41523e}
- FlaxEngine
-
+
-
-
diff --git a/Source/Tools/FlaxEngine.Tests/Properties/AssemblyInfo.cs b/Source/Tools/FlaxEngine.Tests/Properties/AssemblyInfo.cs
index bd19c61ff..dcb4b2201 100644
--- a/Source/Tools/FlaxEngine.Tests/Properties/AssemblyInfo.cs
+++ b/Source/Tools/FlaxEngine.Tests/Properties/AssemblyInfo.cs
@@ -6,9 +6,9 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("FlaxEngine.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
+[assembly: AssemblyCompany("Wojciech Figat")]
[assembly: AssemblyProduct("FlaxEngine.Tests")]
-[assembly: AssemblyCopyright("Copyright © 2012-2018 Wojciech Figat")]
+[assembly: AssemblyCopyright("Copyright © 2012-2022 Wojciech Figat")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]