diff --git a/src/Benchmarks/Benchmarks.csproj b/src/Benchmarks/Benchmarks.csproj index d322d4fae..246612262 100644 --- a/src/Benchmarks/Benchmarks.csproj +++ b/src/Benchmarks/Benchmarks.csproj @@ -3,14 +3,14 @@ Exe x64;x86 - netcoreapp2.0;netcoreapp3.1;net5.0; + netcoreapp2.0;netcoreapp3.1;net5.0;net6.0 false false true Benchmarks.manifest - $(TargetFramework) - netstandard2.0 + netstandard2.0 + $(TargetFramework) false 9.0 diff --git a/src/Benchmarks/Program.cs b/src/Benchmarks/Program.cs index 4b8eae9ed..78babd8db 100644 --- a/src/Benchmarks/Program.cs +++ b/src/Benchmarks/Program.cs @@ -9,7 +9,7 @@ using BenchmarkDotNet.Characteristics; using System.IO; -#if NET5_0 +#if NET [assembly: global::System.Runtime.Versioning.SupportedOSPlatform("Windows10.0.10240.0")] #endif diff --git a/src/Directory.Build.props b/src/Directory.Build.props index cf12ec67f..e90e56077 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -20,6 +20,8 @@ v142 10.0 netcoreapp5.0 + false + true diff --git a/src/Projections/Benchmark/Benchmark.csproj b/src/Projections/Benchmark/Benchmark.csproj index dc5dc1a5f..e0a35b9af 100644 --- a/src/Projections/Benchmark/Benchmark.csproj +++ b/src/Projections/Benchmark/Benchmark.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net5.0 + netstandard2.0;net5.0;net6.0 x64;x86 diff --git a/src/Projections/Benchmark/Module.cs b/src/Projections/Benchmark/Module.cs index 480de12df..912fb2c07 100644 --- a/src/Projections/Benchmark/Module.cs +++ b/src/Projections/Benchmark/Module.cs @@ -1,4 +1,4 @@ -#if NET5_0 +#if NET using System.Runtime.Versioning; [assembly: SupportedOSPlatform("Windows")] #endif diff --git a/src/Projections/Directory.Build.props b/src/Projections/Directory.Build.props index 2a4d3b6cf..4305d901a 100644 --- a/src/Projections/Directory.Build.props +++ b/src/Projections/Directory.Build.props @@ -4,10 +4,10 @@ true - + + + true - - diff --git a/src/Projections/Reunion/Reunion.csproj b/src/Projections/Reunion/Reunion.csproj index 43014019c..0cff1b9ef 100644 --- a/src/Projections/Reunion/Reunion.csproj +++ b/src/Projections/Reunion/Reunion.csproj @@ -1,7 +1,7 @@ - netstandard2.0;net5.0 + netstandard2.0;net5.0;net6.0 x64;x86 Microsoft.WinUI 9.9.9.9 diff --git a/src/Projections/Test/Test.csproj b/src/Projections/Test/Test.csproj index 2dd8d8a4e..2878ba757 100644 --- a/src/Projections/Test/Test.csproj +++ b/src/Projections/Test/Test.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net5.0 + netstandard2.0;net5.0;net6.0 x64;x86 diff --git a/src/Projections/TestHost.ProbeByClass/TestHost.ProbeByClass.csproj b/src/Projections/TestHost.ProbeByClass/TestHost.ProbeByClass.csproj index 16f85c34a..e4874a5de 100644 --- a/src/Projections/TestHost.ProbeByClass/TestHost.ProbeByClass.csproj +++ b/src/Projections/TestHost.ProbeByClass/TestHost.ProbeByClass.csproj @@ -1,7 +1,7 @@  - netstandard2.0;;net5.0 + netstandard2.0;net5.0;net6.0 x64;x86 diff --git a/src/Projections/WinUI/Module.cs b/src/Projections/WinUI/Module.cs index 7eabd5400..83b22e6fb 100644 --- a/src/Projections/WinUI/Module.cs +++ b/src/Projections/WinUI/Module.cs @@ -1,3 +1,3 @@ -#if NET5_0 +#if NET [assembly: global::System.Runtime.Versioning.SupportedOSPlatform("Windows10.0.10240.0")] #endif diff --git a/src/Projections/WinUI/WinUI.csproj b/src/Projections/WinUI/WinUI.csproj index 3228b7d65..bdadc3a37 100644 --- a/src/Projections/WinUI/WinUI.csproj +++ b/src/Projections/WinUI/WinUI.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net5.0 + netstandard2.0;net5.0;net6.0 x64;x86 diff --git a/src/Projections/Windows/Windows.csproj b/src/Projections/Windows/Windows.csproj index 0b2879875..0acfaf0cf 100644 --- a/src/Projections/Windows/Windows.csproj +++ b/src/Projections/Windows/Windows.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net5.0 + netstandard2.0;net5.0;net6.0 x64;x86 Microsoft.Windows.SDK.NET diff --git a/src/Tests/DiagnosticTests/DiagnosticTests.csproj b/src/Tests/DiagnosticTests/DiagnosticTests.csproj index aa19aa2a8..24918520f 100644 --- a/src/Tests/DiagnosticTests/DiagnosticTests.csproj +++ b/src/Tests/DiagnosticTests/DiagnosticTests.csproj @@ -1,7 +1,7 @@  - net5.0-windows10.0.19041.0 + net5.0-windows10.0.19041.0;net6.0-windows10.0.19041.0 false diff --git a/src/Tests/ObjectLifetimeTests/ObjectLifetimeTests.Lifted.csproj b/src/Tests/ObjectLifetimeTests/ObjectLifetimeTests.Lifted.csproj index 21482df70..206a3f1e9 100644 --- a/src/Tests/ObjectLifetimeTests/ObjectLifetimeTests.Lifted.csproj +++ b/src/Tests/ObjectLifetimeTests/ObjectLifetimeTests.Lifted.csproj @@ -1,7 +1,7 @@  WinExe - net5.0-windows10.0.19041.0 + net5.0-windows10.0.19041.0;net6.0-windows10.0.19041.0 10.0.17763.0 ObjectLifetimeTests.Lifted app.manifest diff --git a/src/Tests/UnitTest/TestComponentCSharp_Tests.cs b/src/Tests/UnitTest/TestComponentCSharp_Tests.cs index dd62e0805..8b3d2e5b5 100644 --- a/src/Tests/UnitTest/TestComponentCSharp_Tests.cs +++ b/src/Tests/UnitTest/TestComponentCSharp_Tests.cs @@ -29,13 +29,13 @@ using Windows.Security.Cryptography.Core; using System.Reflection; -#if NET5_0 +#if NET using WeakRefNS = System; #else using WeakRefNS = WinRT; #endif -#if NET5_0 +#if NET // Test SupportedOSPlatform warnings for APIs targeting 10.0.19041.0: [assembly: global::System.Runtime.Versioning.SupportedOSPlatform("Windows10.0.18362.0")] #endif @@ -403,7 +403,7 @@ public void TestReadOnlyDictionaryLookup() Assert.True(LookupPorts().Wait(5000)); } -#if NET5_0 +#if NET async Task InvokeStreamWriteZeroBytes() { var random = new Random(42); @@ -717,10 +717,10 @@ public void TestCustomProjections() Assert.Equal("name", propertyName); bool eventCalled = false; - TestObject.CanExecuteChanged += (object sender, EventArgs e) => - { - eventCalled = true; - }; + TestObject.CanExecuteChanged += (object sender, EventArgs e) => + { + eventCalled = true; + }; TestObject.RaiseCanExecuteChanged(); Assert.True(eventCalled); @@ -734,8 +734,8 @@ public void TestCustomProjections() // Ensure robustness with bad runtime class names (parsing errors, type not found, etc) var badRuntimeClassName = Class.BadRuntimeClassName; Assert.NotNull(badRuntimeClassName); - } - + } + [Fact] public void TestKeyValuePair() { @@ -2483,7 +2483,7 @@ void Class_StaticIntPropertyChanged(object sender, int e) Assert.True(eventCalled); } -#if NET5_0 +#if NET [TestComponentCSharp.Warning] // NO warning CA1416 class WarningManaged { }; diff --git a/src/Tests/UnitTest/UnitTest.csproj b/src/Tests/UnitTest/UnitTest.csproj index a00ffb573..be544ad65 100644 --- a/src/Tests/UnitTest/UnitTest.csproj +++ b/src/Tests/UnitTest/UnitTest.csproj @@ -2,7 +2,7 @@ - netcoreapp2.0;net5.0 + netcoreapp2.0;net5.0;net6.0 x64;x86 UnitTest 1701;1702;0436;1658 @@ -36,7 +36,7 @@ - + diff --git a/src/WinRT.Runtime/AgileReference.cs b/src/WinRT.Runtime/AgileReference.cs index 67e14f838..d910470b3 100644 --- a/src/WinRT.Runtime/AgileReference.cs +++ b/src/WinRT.Runtime/AgileReference.cs @@ -28,7 +28,7 @@ public unsafe AgileReference(IObjectReference instance) ref iid, instance.ThisPtr, &agileReference)); -#if NET5_0 +#if NET _agileReference = (IAgileReference)new SingleInterfaceOptimizedObject(typeof(IAgileReference), ObjectReference.Attach(ref agileReference)); #else _agileReference = ABI.WinRT.Interop.IAgileReference.FromAbi(agileReference).AsType(); @@ -36,7 +36,7 @@ public unsafe AgileReference(IObjectReference instance) } catch(TypeLoadException) { - _cookie = Git.Value.RegisterInterfaceInGlobal(instance, iid); + _cookie = Git.Value.RegisterInterfaceInGlobal(instance, iid); } finally { @@ -51,14 +51,14 @@ protected virtual void Dispose(bool disposing) if (!disposed) { if (_cookie != IntPtr.Zero) - { - try - { - Git.Value.RevokeInterfaceFromGlobal(_cookie); + { + try + { + Git.Value.RevokeInterfaceFromGlobal(_cookie); } catch(ArgumentException) - { - // Revoking cookie from GIT table may fail if apartment is gone. + { + // Revoking cookie from GIT table may fail if apartment is gone. } } disposed = true; diff --git a/src/WinRT.Runtime/WinRT.Runtime.csproj b/src/WinRT.Runtime/WinRT.Runtime.csproj index 125352f7a..664f9db28 100644 --- a/src/WinRT.Runtime/WinRT.Runtime.csproj +++ b/src/WinRT.Runtime/WinRT.Runtime.csproj @@ -1,7 +1,7 @@  - - netstandard2.0;net5.0 + + netstandard2.0;net5.0;net6.0 WinRT true 9 @@ -32,7 +32,7 @@ - + @@ -52,7 +52,7 @@ 1.0.1 $(ApiCompatArgs) --allow-default-interface-methods $(MatchingRefApiCompatArgs) --allow-default-interface-methods - + diff --git a/src/build.cmd b/src/build.cmd index f22ea170c..960eff8a8 100644 --- a/src/build.cmd +++ b/src/build.cmd @@ -1,16 +1,17 @@ @echo off if /i "%cswinrt_echo%" == "on" @echo on -set CsWinRTNet5SdkVersion=5.0.300 +set CsWinRTBuildNetSDKVersion=6.0.100-preview.6.21355.2 +set CsWinRTNet5SdkVersion=5.0.302 set this_dir=%~dp0 :dotnet -rem Install required .NET 5 SDK version and add to environment +rem Install required .NET SDK version and add to environment set DOTNET_ROOT=%LocalAppData%\Microsoft\dotnet set DOTNET_ROOT(86)=%LocalAppData%\Microsoft\dotnet\x86 set path=%DOTNET_ROOT%;%path% - +rem Install .net5 to run our projects targeting it powershell -NoProfile -ExecutionPolicy unrestricted -Command ^ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ^ &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) ^ @@ -21,13 +22,24 @@ powershell -NoProfile -ExecutionPolicy unrestricted -Command ^ &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) ^ -Version '%CsWinRTNet5SdkVersion%' -InstallDir '%DOTNET_ROOT(86)%' -Architecture 'x86' ^ -AzureFeed 'https://dotnetcli.blob.core.windows.net/dotnet' +rem Install .NET Version used to build projection +powershell -NoProfile -ExecutionPolicy unrestricted -Command ^ +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ^ +&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) ^ +-Version '%CsWinRTBuildNetSDKVersion%' -InstallDir '%DOTNET_ROOT%' -Architecture 'x64' ^ +-AzureFeed 'https://dotnetcli.blob.core.windows.net/dotnet' +powershell -NoProfile -ExecutionPolicy unrestricted -Command ^ +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ^ +&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) ^ +-Version '%CsWinRTBuildNetSDKVersion%' -InstallDir '%DOTNET_ROOT(86)%' -Architecture 'x86' ^ +-AzureFeed 'https://dotnetcli.blob.core.windows.net/dotnet' :globaljson rem Create global.json for current .NET SDK, and with allowPrerelease=true set global_json=%this_dir%global.json echo { > %global_json% echo "sdk": { >> %global_json% -echo "version": "%CsWinRTNet5SdkVersion%", >> %global_json% +echo "version": "%CsWinRTBuildNetSDKVersion%", >> %global_json% echo "allowPrerelease": true >> %global_json% echo } >> %global_json% echo } >> %global_json% diff --git a/src/cswinrt/main.cpp b/src/cswinrt/main.cpp index 4cc1446c0..5cee2f320 100644 --- a/src/cswinrt/main.cpp +++ b/src/cswinrt/main.cpp @@ -32,7 +32,7 @@ namespace cswinrt { "output", 0, 1, "", "Location of generated projection" }, { "include", 0, option::no_max, "", "One or more prefixes to include in projection" }, { "exclude", 0, option::no_max, "", "One or more prefixes to exclude from projection" }, - { "target", 0, 1, "", "Target TFM for projection. Omit for compatibility with newest TFM (net5.0)." }, + { "target", 0, 1, "", "Target TFM for projection. Omit for compatibility with newest TFM (net5.0)." }, { "component", 0, 0, {}, "Generate component projection." }, { "verbose", 0, 0, {}, "Show detailed progress information" }, { "help", 0, option::no_max, {}, "Show detailed help" }, @@ -86,7 +86,7 @@ Where is one or more of: settings.verbose = args.exists("verbose"); auto target = args.value("target"); - if (!target.empty() && target != "netstandard2.0" && !starts_with(target, "net5.0")) + if (!target.empty() && target != "netstandard2.0" && !starts_with(target, "net5.0") && !starts_with(target, "net6.0")) { throw usage_exception(); } @@ -386,6 +386,7 @@ Where is one or more of: } catch (usage_exception const&) { + result = 1; print_usage(w); } catch (std::exception const& e) diff --git a/src/cswinrt/strings/additions/Windows.Foundation/Windows.Foundation.cs b/src/cswinrt/strings/additions/Windows.Foundation/Windows.Foundation.cs index 3a3c61c66..6ff035b8d 100644 --- a/src/cswinrt/strings/additions/Windows.Foundation/Windows.Foundation.cs +++ b/src/cswinrt/strings/additions/Windows.Foundation/Windows.Foundation.cs @@ -6,9 +6,9 @@ namespace System using global::System.Runtime.InteropServices; using global::System.Threading; using global::System.Threading.Tasks; - using global::Windows.Foundation; - -#if NET5_0 + using global::Windows.Foundation; + +#if NET [global::System.Runtime.Versioning.SupportedOSPlatform("windows10.0.10240.0")] #endif public static class WindowsRuntimeSystemExtensions @@ -232,7 +232,7 @@ struct VoidValueTypeParameter { } /// using VoidValueTypeParameter offers better performance. internal class VoidReferenceTypeParameter { } -#if NET5_0 +#if NET [global::System.Runtime.Versioning.SupportedOSPlatform("windows10.0.10240.0")] #endif sealed class AsyncInfoToTaskBridge : TaskCompletionSource