Update csprojects to the latest NetCore7

This commit is contained in:
Wojciech Figat
2022-12-19 17:39:39 +01:00
parent a56090e70f
commit f874a0ad57
17 changed files with 130 additions and 174 deletions

View File

@@ -1,5 +1,6 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved. // Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using Flax.Build; using Flax.Build;
@@ -75,7 +76,9 @@ public class Editor : EditorModule
// Visual Studio integration // Visual Studio integration
if (options.Platform.Target == TargetPlatform.Windows && Flax.Build.Platform.BuildTargetPlatform == TargetPlatform.Windows) 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; 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)) if (path != null && File.Exists(path))
options.PrivateDefinitions.Add("USE_VISUAL_STUDIO_DTE"); options.PrivateDefinitions.Add("USE_VISUAL_STUDIO_DTE");
} }

View File

@@ -47,7 +47,7 @@ public:
static gchandle NewGCHandleWeakref(void* obj, bool track_resurrection); static gchandle NewGCHandleWeakref(void* obj, bool track_resurrection);
static void* GetGCHandleTarget(const gchandle& gchandle); static void* GetGCHandleTarget(const gchandle& gchandle);
static void FreeGCHandle(const gchandle& gchandle); static void FreeGCHandle(const gchandle& gchandle);
static bool HasCustomAttribute(void* klass, void* attribClass); static bool HasCustomAttribute(void* klass, void* attribClass);
static bool HasCustomAttribute(void* klass); static bool HasCustomAttribute(void* klass);
static void* GetCustomAttribute(void* klass, void* attribClass); static void* GetCustomAttribute(void* klass, void* attribClass);

Binary file not shown.

View File

@@ -3,7 +3,7 @@
"tfm": "net7.0", "tfm": "net7.0",
"framework": { "framework": {
"name": "Microsoft.NETCore.App", "name": "Microsoft.NETCore.App",
"version": "7.0.0-rc.2.22472.3" "version": "7.0.0"
} }
} }
} }

View File

@@ -1,11 +1,9 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved. // Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
using System.Collections.Generic;
using System.IO; using System.IO;
using System; using System;
using Flax.Build; using Flax.Build;
using Flax.Build.NativeCpp; using Flax.Build.NativeCpp;
using Flax.Build.Platforms;
using Microsoft.Win32; using Microsoft.Win32;
using System.Linq; using System.Linq;
@@ -26,7 +24,6 @@ public class nethost : ThirdPartyModule
BinaryModuleName = "FlaxEngine"; BinaryModuleName = "FlaxEngine";
} }
/// <inheritdoc />
private static Version ParseVersion(string version) private static Version ParseVersion(string version)
{ {
// Give precedence to final releases over release candidate / beta releases // 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 arch = "x64"; //options.Architecture == TargetArchitecture.x64 ? "x64" : "x86";
string dotnetVersion; string dotnetPath, dotnetVersion;
string appHostRuntimePath; 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) 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 baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
using RegistryKey hostKey = baseKey.OpenSubKey(@$"SOFTWARE\dotnet\Setup\InstalledVersions\{arch}\sharedhost"); 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"); using RegistryKey runtimeKey = baseKey.OpenSubKey(@$"SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\{arch}\sharedfx\Microsoft.NETCore.App");
string[] versions = runtimeKey.GetValueNames(); dotnetVersions = runtimeKey.GetValueNames();
#pragma warning restore CA1416
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);
} }
else if (options.Platform.Target == TargetPlatform.Linux) else if (options.Platform.Target == TargetPlatform.Linux)
{ {
// TODO: Support /etc/dotnet/install_location // TODO: Support /etc/dotnet/install_location
string dotnetPath = "/usr/share/dotnet/"; dotnetPath = "/usr/share/dotnet/";
string os = $"linux-{arch}"; os = $"linux-{arch}";
dotnetVersions = Directory.GetDirectories($"{dotnetPath}host/fxr/").Select(x => Path.GetFileName(x)).ToArray();
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);
} }
else else
throw new InvalidPlatformException(options.Platform.Target); 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.PublicIncludePaths.Add(appHostRuntimePath);
options.ScriptingAPI.Defines.Add("USE_NETCORE"); options.ScriptingAPI.Defines.Add("USE_NETCORE");
options.DependencyFiles.Add(Path.Combine(FolderPath, "FlaxEngine.CSharp.runtimeconfig.json")); options.DependencyFiles.Add(Path.Combine(FolderPath, "FlaxEngine.CSharp.runtimeconfig.json"));

View File

@@ -18,7 +18,7 @@ public class FlaxBuildTestsTarget : Target
{ {
base.Init(); base.Init();
Type = TargetType.DotNet; Type = TargetType.DotNetCore;
OutputType = TargetOutputType.Library; OutputType = TargetOutputType.Library;
Platforms = new[] Platforms = new[]
{ {

View File

@@ -1,57 +1,37 @@
<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk">
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\Platforms\DotNet\NUnit\build\NUnit.props" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3FB235A6-ADFF-415E-92B8-E810DA981A02}</ProjectGuid> <ProjectGuid>{3FB235A6-ADFF-415E-92B8-E810DA981A02}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Flax.Build.Tests</RootNamespace>
<AssemblyName>Flax.Build.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<LangVersion>7.3</LangVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TestProjectType>UnitTest</TestProjectType> <TestProjectType>UnitTest</TestProjectType>
<TargetFrameworkProfile /> <TargetFramework>net7.0</TargetFramework>
<Deterministic>true</Deterministic> <LangVersion>11.0</LangVersion>
<NuGetPackageImportStamp> <ImplicitUsings>disable</ImplicitUsings>
</NuGetPackageImportStamp> <Nullable>annotations</Nullable>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\Binaries\Tools\</OutputPath> <OutputPath>..\..\..\Binaries\Tools\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<DefineConstants>USE_NETCORE;FLAX_ASSERTIONS</DefineConstants>
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<IntermediateOutputPath>..\..\..\Cache\Intermediate\Flax.Build.Tests\Debug</IntermediateOutputPath> <IntermediateOutputPath>..\..\..\Cache\Intermediate\Flax.Build.Tests\Debug</IntermediateOutputPath>
<DefineConstants>TRACE;DEBUG;FLAX_ASSERTIONS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\Binaries\Tools\</OutputPath>
<IntermediateOutputPath>..\..\..\Cache\Intermediate\Flax.Build.Tests\Release</IntermediateOutputPath> <IntermediateOutputPath>..\..\..\Cache\Intermediate\Flax.Build.Tests\Release</IntermediateOutputPath>
<DefineConstants>TRACE;FLAX_ASSERTIONS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<Import Project="..\..\Platforms\DotNet\NUnit\build\NUnit.props" />
<ItemGroup> <ItemGroup>
<Reference Include="Flax.Build">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Binaries\Tools\Flax.Build.exe</HintPath>
</Reference>
<Reference Include="nunit.framework"> <Reference Include="nunit.framework">
<HintPath>..\..\Platforms\DotNet\NUnit\build\nunit.framework.dll</HintPath> <HintPath>..\..\Platforms\DotNet\NUnit\build\nunit.framework.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="TestCommandLine.cs" /> <ProjectReference Include="..\Flax.Build\Flax.Build.csproj" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ItemGroup>
</Project> <Compile Remove="Flax.Build.Tests.Build.cs" />
</ItemGroup>
</Project>

View File

@@ -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.Diagnostics;
using System.Reflection; using System.Reflection;
using System.Runtime.Loader; using System.Runtime.Loader;
using System.Text; using System.Collections.Generic;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Text;

View File

@@ -468,7 +468,7 @@ namespace Flax.Build
ProjectName = rulesProjectName, ProjectName = rulesProjectName,
FilePath = null, FilePath = null,
FolderPath = null, FolderPath = null,
Type = TargetType.DotNet, Type = TargetType.DotNetCore,
OutputType = TargetOutputType.Library, OutputType = TargetOutputType.Library,
Platforms = new[] { Platform.BuildPlatform.Target }, Platforms = new[] { Platform.BuildPlatform.Target },
Configurations = new[] { TargetConfiguration.Debug }, Configurations = new[] { TargetConfiguration.Debug },

View File

@@ -189,7 +189,6 @@ namespace Flax.Build
using (new ProfileEventScope("CompileRules")) using (new ProfileEventScope("CompileRules"))
{ {
var assembler = new Assembler(files, Path.Combine(Globals.Root, Configuration.IntermediateFolder, "BuilderRules.cache")); var assembler = new Assembler(files, Path.Combine(Globals.Root, Configuration.IntermediateFolder, "BuilderRules.cache"));
//var assembler = new Assembler(files);
assembly = assembler.Build(); assembly = assembler.Build();
} }

View File

@@ -1,8 +1,8 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved. // Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Collections.Generic;
using Flax.Build.Graph; using Flax.Build.Graph;
using Flax.Build.NativeCpp; using Flax.Build.NativeCpp;

View File

@@ -1,6 +1,10 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved. // Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
using System;
using System.IO;
using System.Net; using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Flax.Build; using Flax.Build;
namespace Flax.Deps namespace Flax.Deps

View File

@@ -1,15 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <LangVersion>11.0</LangVersion>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>annotations</Nullable> <Nullable>annotations</Nullable>
<Configurations>Debug;Release</Configurations> <Configurations>Debug;Release</Configurations>
<BaseOutputPath>..\..\..\Binaries\Tools</BaseOutputPath> <BaseOutputPath>..\..\..\Binaries\Tools</BaseOutputPath>
<OutDir>..\..\..\Binaries\Tools</OutDir> <OutDir>..\..\..\Binaries\Tools</OutDir>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization> <EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<DefineConstants>USE_NETCORE</DefineConstants> <DefineConstants>USE_NETCORE</DefineConstants>
<DebugType>portable</DebugType>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly> <ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<ErrorReport>none</ErrorReport> <ErrorReport>none</ErrorReport>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -32,5 +35,4 @@
<HintPath>..\..\..\Source\Platforms\DotNet\Newtonsoft.Json.dll</HintPath> <HintPath>..\..\..\Source\Platforms\DotNet\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,6 +1,10 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved. // Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
using System;
using System.Text; using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.IO;
namespace Flax.Build.Projects.VisualStudio namespace Flax.Build.Projects.VisualStudio
{ {
@@ -49,9 +53,6 @@ namespace Flax.Build.Projects.VisualStudio
csProjectFileContent.AppendLine("<Project Sdk=\"Microsoft.NET.Sdk\">"); csProjectFileContent.AppendLine("<Project Sdk=\"Microsoft.NET.Sdk\">");
csProjectFileContent.AppendLine(""); csProjectFileContent.AppendLine("");
//csProjectFileContent.AppendLine(string.Format("<Project DefaultTargets=\"Build\" ToolsVersion=\"{0}\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">", projectFileToolVersion));
//csProjectFileContent.AppendLine(" <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />");
// Properties // Properties
csProjectFileContent.AppendLine(" <PropertyGroup>"); csProjectFileContent.AppendLine(" <PropertyGroup>");
@@ -73,16 +74,17 @@ namespace Flax.Build.Projects.VisualStudio
var baseConfigurations = project.Configurations.Select(x => x.Name.Split('|')[0]).Distinct().ToArray(); var baseConfigurations = project.Configurations.Select(x => x.Name.Split('|')[0]).Distinct().ToArray();
csProjectFileContent.AppendLine(" <TargetFramework>net7.0</TargetFramework>"); csProjectFileContent.AppendLine(" <TargetFramework>net7.0</TargetFramework>");
csProjectFileContent.AppendLine(" <ImplicitUsings>enable</ImplicitUsings>"); csProjectFileContent.AppendLine(" <ImplicitUsings>disable</ImplicitUsings>");
csProjectFileContent.AppendLine(" <Nullable>disable</Nullable>"); csProjectFileContent.AppendLine(" <Nullable>annotations</Nullable>");
csProjectFileContent.AppendLine(string.Format(" <Configurations>{0}</Configurations>", string.Join(";", baseConfigurations))); csProjectFileContent.AppendLine(string.Format(" <Configurations>{0}</Configurations>", string.Join(";", baseConfigurations)));
csProjectFileContent.AppendLine(" <EnableDefaultItems>false</EnableDefaultItems>"); // ? csProjectFileContent.AppendLine(" <EnableDefaultItems>false</EnableDefaultItems>");
csProjectFileContent.AppendLine(" <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>"); // Needed for Hostfxr csProjectFileContent.AppendLine(" <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>"); // Needed for Hostfxr
csProjectFileContent.AppendLine(" <EnableDynamicLoading>true</EnableDynamicLoading>"); // ? csProjectFileContent.AppendLine(" <EnableDynamicLoading>true</EnableDynamicLoading>"); // ?
csProjectFileContent.AppendLine(" <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>"); // Prevents outputting the file under net7.0 subdirectory csProjectFileContent.AppendLine(" <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>");
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(" <EnableBaseIntermediateOutputPathMismatchWarning>false</EnableBaseIntermediateOutputPathMismatchWarning>");
csProjectFileContent.AppendLine(" <GenerateAssemblyInfo>false</GenerateAssemblyInfo>");
csProjectFileContent.AppendLine(string.Format(" <RootNamespace>{0}</RootNamespace>", project.BaseName));
csProjectFileContent.AppendLine(string.Format(" <AssemblyName>{0}.CSharp</AssemblyName>", project.BaseName));
csProjectFileContent.AppendLine(" <LangVersion>11.0</LangVersion>"); csProjectFileContent.AppendLine(" <LangVersion>11.0</LangVersion>");
csProjectFileContent.AppendLine(" <FileAlignment>512</FileAlignment>"); 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(" <OutDir>{0}</OutDir>", baseOutputDir)); // This needs to be set here to fix errors in VS
@@ -165,9 +167,10 @@ namespace Flax.Build.Projects.VisualStudio
csProjectFileContent.AppendLine(" <ItemGroup>"); csProjectFileContent.AppendLine(" <ItemGroup>");
foreach (var reference in project.CSharp.SystemReferences) // Unused when using explicitly NetCore7 ?
//foreach (var reference in project.CSharp.SystemReferences)
{ {
csProjectFileContent.AppendLine(string.Format(" <Reference Include=\"{0}\" />", reference)); //csProjectFileContent.AppendLine(string.Format(" <Reference Include=\"{0}\" />", reference));
} }
foreach (var reference in project.CSharp.FileReferences) foreach (var reference in project.CSharp.FileReferences)
@@ -232,7 +235,6 @@ namespace Flax.Build.Projects.VisualStudio
// End // End
//csProjectFileContent.AppendLine(" <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />");
csProjectFileContent.AppendLine("</Project>"); csProjectFileContent.AppendLine("</Project>");
if (defaultTarget.CustomExternalProjectFilePath == null) if (defaultTarget.CustomExternalProjectFilePath == null)

View File

@@ -18,7 +18,7 @@ public class FlaxEngineTestsTarget : Target
{ {
base.Init(); base.Init();
Type = TargetType.DotNet; Type = TargetType.DotNetCore;
OutputType = TargetOutputType.Library; OutputType = TargetOutputType.Library;
Platforms = new[] Platforms = new[]
{ {

View File

@@ -1,80 +1,40 @@
<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk">
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\Platforms\DotNet\NUnit\build\NUnit.props" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4AAED6A2-38B1-4A31-AB04-9264A94A8ECA}</ProjectGuid> <ProjectGuid>{4AAED6A2-38B1-4A31-AB04-9264A94A8ECA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FlaxEngine.Tests</RootNamespace>
<AssemblyName>FlaxEngine.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<LangVersion>7.3</LangVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TestProjectType>UnitTest</TestProjectType> <TestProjectType>UnitTest</TestProjectType>
<TargetFrameworkProfile /> <TargetFramework>net7.0</TargetFramework>
<Deterministic>true</Deterministic> <LangVersion>11.0</LangVersion>
<NuGetPackageImportStamp> <ImplicitUsings>disable</ImplicitUsings>
</NuGetPackageImportStamp> <Nullable>annotations</Nullable>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\Binaries\Tools\</OutputPath>
<IntermediateOutputPath>..\..\..\Cache\Intermediate\FlaxEngine.Tests\Debug</IntermediateOutputPath>
<DefineConstants>TRACE;DEBUG;FLAX_ASSERTIONS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputPath>..\..\..\Binaries\Tools\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<DefineConstants>USE_NETCORE;FLAX_ASSERTIONS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
<IntermediateOutputPath>..\..\..\Cache\Intermediate\FlaxEngine.Tests\Debug</IntermediateOutputPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\Binaries\Tools\</OutputPath>
<IntermediateOutputPath>..\..\..\Cache\Intermediate\FlaxEngine.Tests\Release</IntermediateOutputPath> <IntermediateOutputPath>..\..\..\Cache\Intermediate\FlaxEngine.Tests\Release</IntermediateOutputPath>
<DefineConstants>TRACE;FLAX_ASSERTIONS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<Import Project="..\..\Platforms\DotNet\NUnit\build\NUnit.props" />
<ItemGroup> <ItemGroup>
<Reference Include="nunit.framework"> <Reference Include="nunit.framework">
<HintPath>..\..\Platforms\DotNet\NUnit\build\nunit.framework.dll</HintPath> <HintPath>..\..\Platforms\DotNet\NUnit\build\nunit.framework.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="CircularBufferTests.cs" /> <ProjectReference Include="..\..\FlaxEngine.CSharp.csproj" />
<Compile Include="TestEditorUtils.cs" />
<Compile Include="TestHtmlParser.cs" />
<Compile Include="TestModulusOperator.cs" />
<Compile Include="TestPropertyNameUI.cs" />
<Compile Include="TestQuaternion.cs" />
<Compile Include="TestSerialization.cs" />
<Compile Include="TestStringUtils.cs" />
<Compile Include="TextControl.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestColor.cs" />
<Compile Include="TestContainerControl.cs" />
<Compile Include="TestFloatR10G10B10A2.cs" />
<Compile Include="TestFloatR11G11B10.cs" />
<Compile Include="TestTransform.cs" />
<Compile Include="HistoryStackTests.cs" />
<Compile Include="TestQueryFilterHelper.cs" />
<Compile Include="TestSceneGraph.cs" />
<Compile Include="TestSurface.cs" />
<Compile Include="UndoTests.cs" />
<Compile Include="TestEditorStates.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\FlaxEngine.CSharp.csproj"> <Compile Remove="FlaxEngine.Tests.Build.cs" />
<Project>{ed088b51-41ac-403b-9b3e-91a38c41523e}</Project>
<Name>FlaxEngine</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@@ -6,9 +6,9 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("FlaxEngine.Tests")] [assembly: AssemblyTitle("FlaxEngine.Tests")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("Wojciech Figat")]
[assembly: AssemblyProduct("FlaxEngine.Tests")] [assembly: AssemblyProduct("FlaxEngine.Tests")]
[assembly: AssemblyCopyright("Copyright © 2012-2018 Wojciech Figat")] [assembly: AssemblyCopyright("Copyright © 2012-2022 Wojciech Figat")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
[assembly: ComVisible(false)] [assembly: ComVisible(false)]