diff --git a/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml b/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml index a9aac123c..cf2006667 100644 --- a/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml +++ b/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml @@ -138,6 +138,25 @@ steps: set cswinrt_build_params=/bl:$(Build.SourcesDirectory)\cswinrt.binlog /p:CleanIntermediateDirs=true /p:AllowedReferenceRelatedFileExtensions=".xml;.pri;.dll.config;.exe.config" build.cmd $(BuildPlatform) $(BuildConfiguration) $(VersionNumber) $(Build.BuildNumber) $(WinRT.Runtime.AssemblyVersion) +# Build Tool for Embedded Sample +- task: CmdLine@2 + displayName: Build TestEmbedded Sample + inputs: + workingDirectory: $(Build.SourcesDirectory)\src\Samples\TestEmbedded + script: | + if "%VSCMD_VER%"=="" ( + pushd c: + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" >nul 2>&1 + popd + ) + + set echo_build=on + set only_build=true + rem PDBs being copied for each project reference are causing out of disk space issues in the pipeline. Making use of AllowedReferenceRelatedFileExtensions to avoid them being copied. + set embed_build_params=/p:AllowedReferenceRelatedFileExtensions=".xml;.pri;.dll.config;.exe.config" + build.cmd $(BuildPlatform) $(BuildConfiguration) + + # Mask BuildConfiguration - task: CmdLine@2 displayName: Mask BuildConfiguration diff --git a/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml b/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml index 62cdeb3a1..55feabdfe 100644 --- a/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml +++ b/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml @@ -28,7 +28,6 @@ stages: arm64_Release: BuildPlatform: 'arm64' BuildConfiguration: 'release' - steps: - checkout: self clean: true @@ -43,10 +42,20 @@ stages: condition: and(succeeded(), or(eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildPlatform'], 'x64'))) inputs: command: test - projects: 'src/Tests/UnitTest/UnitTest.csproj ' + projects: 'src/Tests/UnitTest/UnitTest.csproj' arguments: --diag $(Build.ArtifactStagingDirectory)\unittest\test.log --no-build --logger xunit;LogFilePath=UNITTEST-$(Build.BuildNumber).xml /nologo /m /p:platform=$(BuildPlatform);configuration=$(BuildConfiguration) testRunTitle: Unit Tests +# Run Embedded Unit Tests + - task: DotNetCoreCLI@2 + displayName: Run Embedded Unit Tests + condition: and(succeeded(), or(eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildPlatform'], 'x64'))) + inputs: + command: test + projects: 'src/Samples/TestEmbedded/UnitTestEmbedded/UnitTestEmbedded.csproj' + arguments: --diag $(Build.ArtifactStagingDirectory)\unittestembedded\test.log --no-build --logger xunit;LogFilePath=EMBEDDEDUNITTEST-$(Build.BuildNumber).xml /nologo /m /p:platform=$(BuildPlatform);configuration=$(BuildConfiguration) + testRunTitle: Embedded Unit Tests + # Run Object Lifetime Tests - task: VSTest@2 displayName: Run Object Lifetime Tests @@ -63,6 +72,14 @@ stages: PathtoPublish: $(Build.ArtifactStagingDirectory)\unittest ArtifactName: $(BuildConfiguration)_$(BuildPlatform)_UnitTest +# Publish Embedded Test Log + - task: PublishBuildArtifacts@1 + displayName: Publish Embedded Test Log + condition: and(succeeded(), or(eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildPlatform'], 'x64'))) + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)\unittestembedded + ArtifactName: $(BuildConfiguration)_$(BuildPlatform)_UnitTestEmbedded + # Run Host Tests - task: CmdLine@2 displayName: Run Host Tests @@ -88,8 +105,8 @@ stages: exit /b 0 - job: Benchmarks - condition: eq(variables['_RunBenchmarks'],'true') displayName: Run Benchmarks + condition: eq(variables['_RunBenchmarks'],'true') dependsOn: [] pool: vmImage: windows-2019 diff --git a/build/AzurePipelineTemplates/CsWinRT-Pipeline.yml b/build/AzurePipelineTemplates/CsWinRT-Pipeline.yml index 572d77a41..b51caca9e 100644 --- a/build/AzurePipelineTemplates/CsWinRT-Pipeline.yml +++ b/build/AzurePipelineTemplates/CsWinRT-Pipeline.yml @@ -1,11 +1,11 @@ -variables: -- template: CsWinRT-Variables.yml - -name: $(MajorVersion).$(MinorVersion).$(PatchVersion)$(PrereleaseVersion).$(date:yyMMdd)$(rev:.r) - -stages: -- template: CsWinRT-BuildAndTest-Stage.yml - -- template: CsWinRT-PublishToNuget-Stage.yml - +variables: +- template: CsWinRT-Variables.yml + +name: $(MajorVersion).$(MinorVersion).$(PatchVersion)$(PrereleaseVersion).$(date:yyMMdd)$(rev:.r) + +stages: +- template: CsWinRT-BuildAndTest-Stage.yml + +- template: CsWinRT-PublishToNuget-Stage.yml + - template: CsWinRT-PublishToMaestro-Stage.yml \ No newline at end of file diff --git a/nuget/Microsoft.Windows.CsWinRT.Embedded.targets b/nuget/Microsoft.Windows.CsWinRT.Embedded.targets index 38a975bfa..d0e99b35a 100644 --- a/nuget/Microsoft.Windows.CsWinRT.Embedded.targets +++ b/nuget/Microsoft.Windows.CsWinRT.Embedded.targets @@ -11,12 +11,13 @@ Copyright (C) Microsoft Corporation. All rights reserved. $(DefineConstants);EMBED true + $(CsWinRTPath)embedded\ - - - + + + diff --git a/nuget/Microsoft.Windows.CsWinRT.targets b/nuget/Microsoft.Windows.CsWinRT.targets index 5d2d52240..705d26d1e 100644 --- a/nuget/Microsoft.Windows.CsWinRT.targets +++ b/nuget/Microsoft.Windows.CsWinRT.targets @@ -110,7 +110,8 @@ Copyright (C) Microsoft Corporation. All rights reserved. -include WinRT.Interop -embedded - $(TargetFramework) + net5.0 + net6.0 netstandard2.0 $(CsWinRTCommandVerbosity) diff --git a/src/Samples/TestEmbedded/C++ Components/Directory.Build.props b/src/Samples/TestEmbedded/C++ Components/Directory.Build.props new file mode 100644 index 000000000..9851da811 --- /dev/null +++ b/src/Samples/TestEmbedded/C++ Components/Directory.Build.props @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/Samples/TestEmbedded/C++ Components/Directory.Build.targets b/src/Samples/TestEmbedded/C++ Components/Directory.Build.targets new file mode 100644 index 000000000..9851da811 --- /dev/null +++ b/src/Samples/TestEmbedded/C++ Components/Directory.Build.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/Samples/TestEmbedded/Directory.Build.props b/src/Samples/TestEmbedded/Directory.Build.props index 9851da811..7da6bcd19 100644 --- a/src/Samples/TestEmbedded/Directory.Build.props +++ b/src/Samples/TestEmbedded/Directory.Build.props @@ -1,2 +1,19 @@ + + + + + + + + $(Platform) + $([MSBuild]::NormalizeDirectory('$(SolutionDir)../../_build', '$(BuildPlatform)', '$(Configuration)')) + $([MSBuild]::NormalizeDirectory('$(BuildOutDir)', 'cswinrt', 'bin')) + $([MSBuild]::NormalizeDirectory('$(SolutionDir)../../_build', 'x86', '$(Configuration)', 'cswinrt', 'bin')) + $(CsWinRTPath)cswinrt.exe + $([MSBuild]::NormalizeDirectory('$(SolutionDir)../../WinRT.Runtime')) + + + \ No newline at end of file diff --git a/src/Samples/TestEmbedded/Directory.Build.targets b/src/Samples/TestEmbedded/Directory.Build.targets index 9851da811..ef00fcf92 100644 --- a/src/Samples/TestEmbedded/Directory.Build.targets +++ b/src/Samples/TestEmbedded/Directory.Build.targets @@ -1,2 +1,84 @@ + + + + + + + + + + + + + + <_Net2Sources Include="$(WinRTRuntimeSourcesDir)**\*netstandard2.0.cs" /> + <_Net5Sources Include="$(WinRTRuntimeSourcesDir)**\*net5.cs" /> + <_AnySources Include="$(WinRTRuntimeSourcesDir)**\*.cs" /> + <_AnySources Remove="@(_Net2Sources)" /> + <_AnySources Remove="@(_Net5Sources)" /> + <_AnySources Remove="$(WinRTRuntimeSourcesDir)obj\**\*.cs" /> + <_AnySources Remove="$(WinRTRuntimeSourcesDir)bin\**\*.cs" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Samples/TestEmbedded/Net5App.Bootstrap/Net5App.Bootstrap.csproj b/src/Samples/TestEmbedded/Net5App.Bootstrap/Net5App.Bootstrap.csproj index 4d4adf70b..8595d924b 100644 --- a/src/Samples/TestEmbedded/Net5App.Bootstrap/Net5App.Bootstrap.csproj +++ b/src/Samples/TestEmbedded/Net5App.Bootstrap/Net5App.Bootstrap.csproj @@ -2,19 +2,17 @@ Exe net5.0-windows - x64;x86;ARM64 + x64;x86 9 + true true sdk + true - - - - @@ -31,21 +29,16 @@ Alpha; Beta; Gamma; - Windows.Devices.Geolocation; - Windows.Foundation.Metadata - Windows.Foundation.UniversalApiContract; - Windows.Foundation.IAsyncOperation; - Windows.Foundation.TypedEventHandler; - Windows.Foundation.FoundationContract; - Windows.Foundation.IAsyncInfo; - Windows.Foundation.IAsyncAction; - Windows.Foundation.AsyncStatus; - Windows.Foundation.AsyncActionCompletedHandler; - Windows.Foundation.AsyncActionProgressHandler; - Windows.Foundation.AsyncActionWithProgressCompletedHandler; - Windows.Foundation.AsyncOperationProgressHandler; - Windows.Foundation.AsyncOperationCompletedHandler; - Windows.Foundation.AsyncOperationWithProgressCompletedHandler; + Windows.Media.AudioFrame; + Windows.Media.AudioBuffer; + Windows.Media.IAudioBuffer; + Windows.Media.IMediaFrame; + Windows.Media.IAudioFrame; + Windows.Foundation; + + Windows.Foundation.Diagnostics; + Windows.Foundation.PropertyType; + diff --git a/src/Samples/TestEmbedded/Net5App.Bootstrap/Program.cs b/src/Samples/TestEmbedded/Net5App.Bootstrap/Program.cs index 8faf71f1e..bd9872f5b 100644 --- a/src/Samples/TestEmbedded/Net5App.Bootstrap/Program.cs +++ b/src/Samples/TestEmbedded/Net5App.Bootstrap/Program.cs @@ -2,7 +2,7 @@ using Alpha; using Beta; using Gamma; -using Windows.Devices.Geolocation; +using Windows.Media; namespace Net5App.Bootstrap { @@ -23,7 +23,8 @@ static void Main(string[] args) Console.WriteLine("Expect 5, Got " + testLib.Test4()); - testLib.Test5(); + Console.WriteLine("Expect 20, Got " + testLib.Test5()); + } } @@ -45,21 +46,8 @@ class MyGreek : IAlpha, IGamma public class TestLib { - Geolocator g; public TestLib() { - WinRT.ComWrappersSupport.RegisterProjectionAssembly(typeof(TestLib).Assembly); - g = new(); - } - - public void SetDesiredAccuracy() - { - g.DesiredAccuracy = PositionAccuracy.Default; - } - - public void ShowDesiredAccuracy() - { - Console.WriteLine("Desired accuracy = " + g.DesiredAccuracy); } internal int Test1_Helper(IAlpha alpha) { return alpha.Five(); } @@ -71,8 +59,6 @@ public int Test1() return Test1_Helper(a) + Test1_Helper(g); } - internal IBeta Test2_Helper(IBeta beta) { return beta; } - public int Test2() { MyGreek g = new(); @@ -97,17 +83,13 @@ public int Test4() return qiAgent.Run(x); } - async System.Threading.Tasks.Task CallGeoAsyncApi() - { - Geolocator g = new(); - g.DesiredAccuracy = PositionAccuracy.Default; - Console.WriteLine("Desired accuracy " + g.DesiredAccuracy); - Geoposition pos = await g.GetGeopositionAsync(); - } - - public void Test5() + public int Test5() { - CallGeoAsyncApi().Wait(1000); + var aframe = new Windows.Media.AudioFrame(20); + using (AudioBuffer abuff = aframe.LockBuffer(AudioBufferAccessMode.Read)) + { + return (int)abuff.Capacity; + } } } } diff --git a/src/Samples/TestEmbedded/Net5App/Net5App.csproj b/src/Samples/TestEmbedded/Net5App/Net5App.csproj index c9661482a..87718352b 100644 --- a/src/Samples/TestEmbedded/Net5App/Net5App.csproj +++ b/src/Samples/TestEmbedded/Net5App/Net5App.csproj @@ -1,17 +1,12 @@  Exe - x64;x86;ARM64 + x64;x86 net5.0-windows + true sdk - - - - - diff --git a/src/Samples/TestEmbedded/NetCore3App/NetCore3App.csproj b/src/Samples/TestEmbedded/NetCore3App/NetCore3App.csproj index 6f2be948d..d3c248ec9 100644 --- a/src/Samples/TestEmbedded/NetCore3App/NetCore3App.csproj +++ b/src/Samples/TestEmbedded/NetCore3App/NetCore3App.csproj @@ -2,7 +2,7 @@ Exe netcoreapp3.1 - x64;x86;ARM64 + x64;x86 9 diff --git a/src/Samples/TestEmbedded/NetCore3App/Program.cs b/src/Samples/TestEmbedded/NetCore3App/Program.cs index 287a3e024..7052573a2 100644 --- a/src/Samples/TestEmbedded/NetCore3App/Program.cs +++ b/src/Samples/TestEmbedded/NetCore3App/Program.cs @@ -3,7 +3,7 @@ namespace NetCore3App { class Program - { + { static void Main(string[] args) { Console.WriteLine("Hello World!"); @@ -19,7 +19,7 @@ static void Main(string[] args) Console.WriteLine("Expect 5, Got " + testLib.Test4()); - testLib.Test5(); + Console.WriteLine("Expect 20, Got " + testLib.Test5()); } - } + } } diff --git a/src/Samples/TestEmbedded/NetFrameworkApp/NetFrameworkApp.csproj b/src/Samples/TestEmbedded/NetFrameworkApp/NetFrameworkApp.csproj index 2bfb46fe6..b46eae9d9 100644 --- a/src/Samples/TestEmbedded/NetFrameworkApp/NetFrameworkApp.csproj +++ b/src/Samples/TestEmbedded/NetFrameworkApp/NetFrameworkApp.csproj @@ -2,17 +2,19 @@ Exe net47 - x64;x86;ARM64 + x64;x86 + win7-x64;win7-x86 9 + true true 10.0.19041.0 + true - @@ -28,21 +30,16 @@ Alpha; Beta; Gamma; - Windows.Devices.Geolocation; - Windows.Foundation.Metadata; - Windows.Foundation.UniversalApiContract; - Windows.Foundation.IAsyncOperation; - Windows.Foundation.TypedEventHandler; - Windows.Foundation.FoundationContract; - Windows.Foundation.IAsyncInfo; - Windows.Foundation.IAsyncAction; - Windows.Foundation.AsyncStatus; - Windows.Foundation.AsyncActionCompletedHandler; - Windows.Foundation.AsyncActionProgressHandler; - Windows.Foundation.AsyncActionWithProgressCompletedHandler; - Windows.Foundation.AsyncOperationProgressHandler; - Windows.Foundation.AsyncOperationCompletedHandler; - Windows.Foundation.AsyncOperationWithProgressCompletedHandler; + Windows.Media.AudioFrame; + Windows.Media.AudioBuffer; + Windows.Media.IAudioBuffer; + Windows.Media.IMediaFrame; + Windows.Media.IAudioFrame; + Windows.Foundation; + + Windows.Foundation.Diagnostics; + Windows.Foundation.PropertyType; + diff --git a/src/Samples/TestEmbedded/NetFrameworkApp/Program.cs b/src/Samples/TestEmbedded/NetFrameworkApp/Program.cs index a787df462..16626e0e7 100644 --- a/src/Samples/TestEmbedded/NetFrameworkApp/Program.cs +++ b/src/Samples/TestEmbedded/NetFrameworkApp/Program.cs @@ -2,7 +2,7 @@ using Alpha; using Beta; using Gamma; -using Windows.Devices.Geolocation; +using Windows.Media; namespace NetFrameworkApp { @@ -23,8 +23,7 @@ static void Main(string[] args) Console.WriteLine("Expect 5, Got " + testLib.Test4()); - testLib.Test5(); - + Console.WriteLine("Expect 20, Got " + testLib.Test5()); } } @@ -46,21 +45,8 @@ class MyGreek : IAlpha, IGamma public class TestLib { - Geolocator g; public TestLib() - { - WinRT.ComWrappersSupport.RegisterProjectionAssembly(typeof(TestLib).Assembly); - g = new(); - } - - public void SetDesiredAccuracy() - { - g.DesiredAccuracy = PositionAccuracy.Default; - } - - public void ShowDesiredAccuracy() - { - Console.WriteLine("Desired accuracy = " + g.DesiredAccuracy); + { } internal int Test1_Helper(IAlpha alpha) { return alpha.Five(); } @@ -72,8 +58,6 @@ public int Test1() return Test1_Helper(a) + Test1_Helper(g); } - internal IBeta Test2_Helper(IBeta beta) { return beta; } - public int Test2() { MyGreek g = new(); @@ -98,17 +82,14 @@ public int Test4() return qiAgent.Run(x); } - async System.Threading.Tasks.Task CallGeoAsyncApi() - { - Geolocator g = new(); - g.DesiredAccuracy = PositionAccuracy.Default; - Console.WriteLine("Desired accuracy " + g.DesiredAccuracy); - Geoposition pos = await g.GetGeopositionAsync(); - } - - public void Test5() + public int Test5() { - CallGeoAsyncApi().Wait(1000); + // make a Windows.Media.AudioFrame + var aframe = new Windows.Media.AudioFrame(20); + using (AudioBuffer abuff = aframe.LockBuffer(AudioBufferAccessMode.Read)) + { + return (int)abuff.Capacity; + } } } diff --git a/src/Samples/TestEmbedded/TestEmbedded.sln b/src/Samples/TestEmbedded/TestEmbedded.sln index fdf9d16be..da94ca9ab 100644 --- a/src/Samples/TestEmbedded/TestEmbedded.sln +++ b/src/Samples/TestEmbedded/TestEmbedded.sln @@ -1,11 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31624.102 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32328.378 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestEmbeddedLibrary", "TestEmbeddedLibrary\TestEmbeddedLibrary.csproj", "{A732BAA0-7E07-462F-B11B-179210D50C1A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "C++ Components", "C++ Components", "{8E83DE92-80F7-4DD8-9B87-1AB3D6A75E3B}" + ProjectSection(SolutionItems) = preProject + C++ Components\Directory.Build.props = C++ Components\Directory.Build.props + C++ Components\Directory.Build.targets = C++ Components\Directory.Build.targets + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Alpha", "C++ Components\Alpha\Alpha.vcxproj", "{9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}" EndProject @@ -32,122 +36,138 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net5App.Bootstrap", "Net5Ap EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A732BAA0-7E07-462F-B11B-179210D50C1A}.Debug|Any CPU.ActiveCfg = Debug|x86 + {A732BAA0-7E07-462F-B11B-179210D50C1A}.Debug|Any CPU.Build.0 = Debug|x86 {A732BAA0-7E07-462F-B11B-179210D50C1A}.Debug|ARM64.ActiveCfg = Debug|x64 - {A732BAA0-7E07-462F-B11B-179210D50C1A}.Debug|ARM64.Build.0 = Debug|x64 {A732BAA0-7E07-462F-B11B-179210D50C1A}.Debug|x64.ActiveCfg = Debug|x64 {A732BAA0-7E07-462F-B11B-179210D50C1A}.Debug|x64.Build.0 = Debug|x64 {A732BAA0-7E07-462F-B11B-179210D50C1A}.Debug|x86.ActiveCfg = Debug|x86 {A732BAA0-7E07-462F-B11B-179210D50C1A}.Debug|x86.Build.0 = Debug|x86 - {A732BAA0-7E07-462F-B11B-179210D50C1A}.Release|ARM64.ActiveCfg = Release|Any CPU - {A732BAA0-7E07-462F-B11B-179210D50C1A}.Release|ARM64.Build.0 = Release|Any CPU + {A732BAA0-7E07-462F-B11B-179210D50C1A}.Release|Any CPU.ActiveCfg = Release|x86 + {A732BAA0-7E07-462F-B11B-179210D50C1A}.Release|Any CPU.Build.0 = Release|x86 + {A732BAA0-7E07-462F-B11B-179210D50C1A}.Release|ARM64.ActiveCfg = Release|x64 {A732BAA0-7E07-462F-B11B-179210D50C1A}.Release|x64.ActiveCfg = Release|x64 {A732BAA0-7E07-462F-B11B-179210D50C1A}.Release|x64.Build.0 = Release|x64 {A732BAA0-7E07-462F-B11B-179210D50C1A}.Release|x86.ActiveCfg = Release|x86 {A732BAA0-7E07-462F-B11B-179210D50C1A}.Release|x86.Build.0 = Release|x86 + {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Debug|Any CPU.Build.0 = Debug|Win32 {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Debug|ARM64.Build.0 = Debug|ARM64 {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Debug|x64.ActiveCfg = Debug|x64 {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Debug|x64.Build.0 = Debug|x64 {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Debug|x86.ActiveCfg = Debug|Win32 {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Debug|x86.Build.0 = Debug|Win32 + {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Release|Any CPU.ActiveCfg = Release|Win32 + {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Release|Any CPU.Build.0 = Release|Win32 {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Release|ARM64.ActiveCfg = Release|ARM64 - {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Release|ARM64.Build.0 = Release|ARM64 {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Release|x64.ActiveCfg = Release|x64 {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Release|x64.Build.0 = Release|x64 {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Release|x86.ActiveCfg = Release|Win32 {9D73F8C2-332B-4AA9-95E3-59C92E68EFB4}.Release|x86.Build.0 = Release|Win32 + {DDB1A216-1527-4F49-8729-17A6519659C8}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {DDB1A216-1527-4F49-8729-17A6519659C8}.Debug|Any CPU.Build.0 = Debug|Win32 {DDB1A216-1527-4F49-8729-17A6519659C8}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {DDB1A216-1527-4F49-8729-17A6519659C8}.Debug|ARM64.Build.0 = Debug|ARM64 {DDB1A216-1527-4F49-8729-17A6519659C8}.Debug|x64.ActiveCfg = Debug|x64 {DDB1A216-1527-4F49-8729-17A6519659C8}.Debug|x64.Build.0 = Debug|x64 {DDB1A216-1527-4F49-8729-17A6519659C8}.Debug|x86.ActiveCfg = Debug|Win32 {DDB1A216-1527-4F49-8729-17A6519659C8}.Debug|x86.Build.0 = Debug|Win32 + {DDB1A216-1527-4F49-8729-17A6519659C8}.Release|Any CPU.ActiveCfg = Release|Win32 + {DDB1A216-1527-4F49-8729-17A6519659C8}.Release|Any CPU.Build.0 = Release|Win32 {DDB1A216-1527-4F49-8729-17A6519659C8}.Release|ARM64.ActiveCfg = Release|ARM64 - {DDB1A216-1527-4F49-8729-17A6519659C8}.Release|ARM64.Build.0 = Release|ARM64 {DDB1A216-1527-4F49-8729-17A6519659C8}.Release|x64.ActiveCfg = Release|x64 {DDB1A216-1527-4F49-8729-17A6519659C8}.Release|x64.Build.0 = Release|x64 {DDB1A216-1527-4F49-8729-17A6519659C8}.Release|x86.ActiveCfg = Release|Win32 {DDB1A216-1527-4F49-8729-17A6519659C8}.Release|x86.Build.0 = Release|Win32 + {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Debug|Any CPU.Build.0 = Debug|Win32 {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Debug|ARM64.Build.0 = Debug|ARM64 {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Debug|x64.ActiveCfg = Debug|x64 {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Debug|x64.Build.0 = Debug|x64 {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Debug|x86.ActiveCfg = Debug|Win32 {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Debug|x86.Build.0 = Debug|Win32 + {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Release|Any CPU.ActiveCfg = Release|Win32 + {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Release|Any CPU.Build.0 = Release|Win32 {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Release|ARM64.ActiveCfg = Release|ARM64 - {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Release|ARM64.Build.0 = Release|ARM64 {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Release|x64.ActiveCfg = Release|x64 {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Release|x64.Build.0 = Release|x64 {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Release|x86.ActiveCfg = Release|Win32 {E1C44B28-965C-45AB-BCB4-475B627E32A6}.Release|x86.Build.0 = Release|Win32 + {1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}.Debug|Any CPU.ActiveCfg = Debug|x86 {1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}.Debug|ARM64.ActiveCfg = Debug|x64 - {1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}.Debug|ARM64.Build.0 = Debug|x64 {1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}.Debug|x64.ActiveCfg = Debug|x64 {1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}.Debug|x64.Build.0 = Debug|x64 {1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}.Debug|x86.ActiveCfg = Debug|x86 {1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}.Debug|x86.Build.0 = Debug|x86 + {1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}.Release|Any CPU.ActiveCfg = Release|x86 {1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}.Release|ARM64.ActiveCfg = Release|ARM64 - {1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}.Release|ARM64.Build.0 = Release|ARM64 {1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}.Release|x64.ActiveCfg = Release|x64 {1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}.Release|x64.Build.0 = Release|x64 {1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}.Release|x86.ActiveCfg = Release|x86 {1FD2F1DA-ACF3-408F-BD13-9D1BA24833E0}.Release|x86.Build.0 = Release|x86 + {9B147973-329B-4331-8207-B6832696D01A}.Debug|Any CPU.ActiveCfg = Debug|x86 {9B147973-329B-4331-8207-B6832696D01A}.Debug|ARM64.ActiveCfg = Debug|x64 - {9B147973-329B-4331-8207-B6832696D01A}.Debug|ARM64.Build.0 = Debug|x64 {9B147973-329B-4331-8207-B6832696D01A}.Debug|x64.ActiveCfg = Debug|x64 {9B147973-329B-4331-8207-B6832696D01A}.Debug|x64.Build.0 = Debug|x64 {9B147973-329B-4331-8207-B6832696D01A}.Debug|x86.ActiveCfg = Debug|x86 {9B147973-329B-4331-8207-B6832696D01A}.Debug|x86.Build.0 = Debug|x86 - {9B147973-329B-4331-8207-B6832696D01A}.Release|ARM64.ActiveCfg = Release|AR64 - {9B147973-329B-4331-8207-B6832696D01A}.Release|ARM64.Build.0 = Release|AR64 + {9B147973-329B-4331-8207-B6832696D01A}.Release|Any CPU.ActiveCfg = Release|x86 + {9B147973-329B-4331-8207-B6832696D01A}.Release|ARM64.ActiveCfg = Release|ARM64 {9B147973-329B-4331-8207-B6832696D01A}.Release|x64.ActiveCfg = Release|x64 {9B147973-329B-4331-8207-B6832696D01A}.Release|x64.Build.0 = Release|x64 {9B147973-329B-4331-8207-B6832696D01A}.Release|x86.ActiveCfg = Release|x86 {9B147973-329B-4331-8207-B6832696D01A}.Release|x86.Build.0 = Release|x86 + {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Debug|Any CPU.ActiveCfg = Debug|x86 + {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Debug|Any CPU.Build.0 = Debug|x86 {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Debug|ARM64.ActiveCfg = Debug|x64 - {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Debug|ARM64.Build.0 = Debug|x64 {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Debug|x64.ActiveCfg = Debug|x64 {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Debug|x64.Build.0 = Debug|x64 {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Debug|x86.ActiveCfg = Debug|x86 {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Debug|x86.Build.0 = Debug|x86 - {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Release|ARM64.ActiveCfg = Release|ARM64 - {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Release|ARM64.Build.0 = Release|ARM64 + {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Release|Any CPU.ActiveCfg = Release|x86 + {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Release|Any CPU.Build.0 = Release|x86 + {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Release|ARM64.ActiveCfg = Release|x64 {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Release|x64.ActiveCfg = Release|x64 {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Release|x64.Build.0 = Release|x64 {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Release|x86.ActiveCfg = Release|x86 {C7796A44-CD3E-4A04-9BED-42D2233C1182}.Release|x86.Build.0 = Release|x86 - {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Debug|ARM64.Build.0 = Debug|Any CPU + {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Debug|Any CPU.ActiveCfg = Debug|x86 + {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Debug|Any CPU.Build.0 = Debug|x86 + {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Debug|ARM64.ActiveCfg = Debug|x64 {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Debug|x64.ActiveCfg = Debug|x64 {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Debug|x64.Build.0 = Debug|x64 {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Debug|x86.ActiveCfg = Debug|x86 {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Debug|x86.Build.0 = Debug|x86 - {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Release|ARM64.ActiveCfg = Release|Any CPU - {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Release|ARM64.Build.0 = Release|Any CPU - {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Release|x64.ActiveCfg = Release|Any CPU - {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Release|x64.Build.0 = Release|Any CPU - {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Release|x86.ActiveCfg = Release|Any CPU - {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Release|x86.Build.0 = Release|Any CPU - {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Debug|ARM64.Build.0 = Debug|Any CPU + {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Release|Any CPU.ActiveCfg = Release|x86 + {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Release|Any CPU.Build.0 = Release|x86 + {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Release|ARM64.ActiveCfg = Release|ARM64 + {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Release|x64.ActiveCfg = Release|x64 + {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Release|x64.Build.0 = Release|x64 + {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Release|x86.ActiveCfg = Release|x86 + {6A457D15-4080-4CCA-9980-D418C2EE2BDF}.Release|x86.Build.0 = Release|x86 + {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Debug|Any CPU.ActiveCfg = Debug|x86 + {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Debug|Any CPU.Build.0 = Debug|x86 + {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Debug|ARM64.ActiveCfg = Debug|x64 {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Debug|x64.ActiveCfg = Debug|x64 {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Debug|x64.Build.0 = Debug|x64 {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Debug|x86.ActiveCfg = Debug|x86 {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Debug|x86.Build.0 = Debug|x86 - {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Release|ARM64.ActiveCfg = Release|Any CPU - {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Release|ARM64.Build.0 = Release|Any CPU - {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Release|x64.ActiveCfg = Release|Any CPU - {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Release|x64.Build.0 = Release|Any CPU - {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Release|x86.ActiveCfg = Release|Any CPU - {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Release|x86.Build.0 = Release|Any CPU + {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Release|Any CPU.ActiveCfg = Release|x86 + {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Release|Any CPU.Build.0 = Release|x86 + {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Release|ARM64.ActiveCfg = Release|ARM64 + {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Release|x64.ActiveCfg = Release|x64 + {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Release|x64.Build.0 = Release|x64 + {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Release|x86.ActiveCfg = Release|x86 + {D2D4B83C-1E8B-44F0-BCC3-217B6D9141FB}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Samples/TestEmbedded/TestEmbeddedLibrary/TestEmbeddedLibrary.csproj b/src/Samples/TestEmbedded/TestEmbeddedLibrary/TestEmbeddedLibrary.csproj index 96e92869c..ea19698c8 100644 --- a/src/Samples/TestEmbedded/TestEmbeddedLibrary/TestEmbeddedLibrary.csproj +++ b/src/Samples/TestEmbedded/TestEmbeddedLibrary/TestEmbeddedLibrary.csproj @@ -1,25 +1,25 @@  + net6.0-windows;net5.0-windows;netstandard2.0;net48 - x64;x86;ARM64 + x64;x86 9 true 10.0.19041.0 + true + true - - - - + @@ -30,22 +30,16 @@ Alpha; Beta; Gamma; - Windows.Devices.Geolocation; - Windows.Foundation.Metadata; - Windows.Foundation.UniversalApiContract; - Windows.Foundation.IAsyncOperation; - Windows.Foundation.TypedEventHandler; - Windows.Foundation.UniversalApiContract; - Windows.Foundation.FoundationContract; - Windows.Foundation.IAsyncInfo; - Windows.Foundation.IAsyncAction; - Windows.Foundation.AsyncStatus; - Windows.Foundation.AsyncActionCompletedHandler; - Windows.Foundation.AsyncActionProgressHandler; - Windows.Foundation.AsyncActionWithProgressCompletedHandler; - Windows.Foundation.AsyncOperationProgressHandler; - Windows.Foundation.AsyncOperationCompletedHandler; - Windows.Foundation.AsyncOperationWithProgressCompletedHandler; + Windows.Media.AudioFrame; + Windows.Media.AudioBuffer; + Windows.Media.IAudioBuffer; + Windows.Media.IMediaFrame; + Windows.Media.IAudioFrame; + Windows.Foundation; + + Windows.Foundation.Diagnostics; + Windows.Foundation.PropertyType; + diff --git a/src/Samples/TestEmbedded/TestEmbeddedLibrary/TestLib.cs b/src/Samples/TestEmbedded/TestEmbeddedLibrary/TestLib.cs index 166eb5906..652a080f8 100644 --- a/src/Samples/TestEmbedded/TestEmbeddedLibrary/TestLib.cs +++ b/src/Samples/TestEmbedded/TestEmbeddedLibrary/TestLib.cs @@ -2,7 +2,7 @@ using Alpha; using Beta; using Gamma; -using Windows.Devices.Geolocation; +using Windows.Media; namespace TestEmbeddedLibrary { @@ -61,20 +61,14 @@ public int Test4() return qiAgent.Run(x); } - async System.Threading.Tasks.Task CallGeoAsyncApi() + public int Test5() { - Console.WriteLine("Making a Microsoft.Devices.Geolocation.Geolocator object..."); - Geolocator g = new(); - Console.WriteLine("Setting the Desired Accuracy to Default on the Geolocator object..."); - g.DesiredAccuracy = PositionAccuracy.Default; - Console.WriteLine("Accessing the Desired Accuracy, shows: " + g.DesiredAccuracy); - Console.WriteLine("Calling GetGeopositionAsync..."); - Geoposition pos = await g.GetGeopositionAsync(); - } - - public void Test5() - { - CallGeoAsyncApi().Wait(1000); + // make a Windows.Media.AudioFrame + var aframe = new Windows.Media.AudioFrame(20); + using (AudioBuffer abuff = aframe.LockBuffer(AudioBufferAccessMode.Read)) + { + return (int)abuff.Capacity; + } } } diff --git a/src/Samples/TestEmbedded/UnitTestEmbedded/TestClass.cs b/src/Samples/TestEmbedded/UnitTestEmbedded/TestClass.cs index 5c3ab0a48..2cd3e6696 100644 --- a/src/Samples/TestEmbedded/UnitTestEmbedded/TestClass.cs +++ b/src/Samples/TestEmbedded/UnitTestEmbedded/TestClass.cs @@ -36,8 +36,7 @@ public void Test4() [Fact] public void Test5() { - TestLib.Test5(); - Assert.True(true); + Assert.Equal(20, TestLib.Test5()); } } } diff --git a/src/Samples/TestEmbedded/UnitTestEmbedded/UnitTestEmbedded.csproj b/src/Samples/TestEmbedded/UnitTestEmbedded/UnitTestEmbedded.csproj index 6ddb56373..741b35af9 100644 --- a/src/Samples/TestEmbedded/UnitTestEmbedded/UnitTestEmbedded.csproj +++ b/src/Samples/TestEmbedded/UnitTestEmbedded/UnitTestEmbedded.csproj @@ -4,14 +4,14 @@ netcoreapp2.0;net5.0;net6.0 x64;x86 false + true 9 + false false - - runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Samples/TestEmbedded/build.cmd b/src/Samples/TestEmbedded/build.cmd new file mode 100644 index 000000000..87520aed5 --- /dev/null +++ b/src/Samples/TestEmbedded/build.cmd @@ -0,0 +1,63 @@ +@echo off +if /i "%echo_build%" == "on" @echo on + +set this_dir=%~dp0 + +:params +set build_platform=%1 +set build_configuration=%2 + +if "%build_platform%"=="" set build_platform=x64 +if "%build_configuration%"=="" set build_configuration=Release + +set nuget_dir=%this_dir%.nuget + +:restore +rem When a preview nuget is required, update -self doesn't work, so manually update +if exist %nuget_dir%\nuget.exe ( + %nuget_dir%\nuget.exe | findstr 5.9 >nul + if ErrorLevel 1 ( + echo Updating to nuget 5.9 + rd /s/q %nuget_dir% >nul 2>&1 + ) +) +if not exist %nuget_dir% md %nuget_dir% +if not exist %nuget_dir%\nuget.exe powershell -Command "Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/v5.8.0-preview.2/nuget.exe -OutFile %nuget_dir%\nuget.exe" +%nuget_dir%\nuget update -self +call :exec %nuget_dir%\nuget.exe restore %nuget_params% %this_dir%TestEmbedded.sln + +:build +echo Building TestEmbedded for %build_platform% %build_configuration% +call :exec msbuild.exe %embed_build_params% /p:platform=%build_platform%;configuration=%build_configuration% /bl:embeddedsample.binlog %this_dir%TestEmbedded.sln +if ErrorLevel 1 ( + echo. + echo ERROR: TestEmbedded Build failed + exit /b !ErrorLevel! +) +if "%only_build%"=="true" goto :eof + +:test +rem Build/Run xUnit tests, generating xml output report for Azure Devops reporting, via XunitXml.TestLogger NuGet +if %build_platform%==x86 ( + set dotnet_exe="%DOTNET_ROOT(86)%\dotnet.exe" +) else ( + set dotnet_exe="%DOTNET_ROOT%\dotnet.exe" +) +if not exist %dotnet_exe% ( + if %build_platform%==x86 ( + set dotnet_exe="%ProgramFiles(x86)%\dotnet\dotnet.exe" + ) else ( + set dotnet_exe="%ProgramFiles%\dotnet\dotnet.exe" + ) +) + +call :exec %dotnet_exe% test --verbosity normal --no-build --logger xunit;LogFilePath=%~dp0embedunittest.xml %this_dir%UnitTestEmbedded/UnitTestEmbedded.csproj /nologo /m /p:platform=%build_platform%;configuration=%build_configuration% +if ErrorLevel 1 ( + echo. + echo ERROR: TestEmbedded unit test failed + exit /b !ErrorLevel! +) + +:exec +%* +goto :eof \ No newline at end of file