From 7f576c73b6f78709e9d40400ce0a67dbfb87fd49 Mon Sep 17 00:00:00 2001
From: Joshua Larkin <70237359+j0shuams@users.noreply.github.com>
Date: Tue, 5 Apr 2022 17:48:00 -0700
Subject: [PATCH 1/6] Update
---
.../CsWinRT-BuildAndTest-Stage.yml | 59 +-
.../CsWinRT-Pipeline.yml | 20 +-
nuget/Microsoft.Windows.CsWinRT.targets | 3 +-
.../C++ Components/Directory.Build.props | 2 +
.../C++ Components/Directory.Build.targets | 2 +
.../TestEmbedded/Directory.Build.props | 17 +
.../TestEmbedded/Directory.Build.targets | 123 ++++
.../Net5App.Bootstrap.csproj | 33 +-
.../TestEmbedded/Net5App.Bootstrap/Program.cs | 36 +-
.../TestEmbedded/Net5App/Net5App.csproj | 9 +-
.../NetCore3App/NetCore3App.csproj | 2 +-
.../TestEmbedded/NetCore3App/Program.cs | 6 +-
.../NetFrameworkApp/NetFrameworkApp.csproj | 31 +-
.../TestEmbedded/NetFrameworkApp/Program.cs | 41 +-
src/Samples/TestEmbedded/TestEmbedded.sln | 90 +--
.../TestEmbeddedLibrary.csproj | 36 +-
.../TestEmbeddedLibrary/TestLib.cs | 22 +-
.../UnitTestEmbedded/TestClass.cs | 3 +-
.../UnitTestEmbedded/UnitTestEmbedded.csproj | 4 +-
src/Samples/TestEmbedded/build.cmd | 63 +++
src/build.cmd | 523 +++++++++---------
21 files changed, 654 insertions(+), 471 deletions(-)
create mode 100644 src/Samples/TestEmbedded/C++ Components/Directory.Build.props
create mode 100644 src/Samples/TestEmbedded/C++ Components/Directory.Build.targets
create mode 100644 src/Samples/TestEmbedded/build.cmd
diff --git a/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml b/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml
index 576931764..8d5766919 100644
--- a/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml
+++ b/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml
@@ -173,27 +173,23 @@ stages:
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)
-# Mask BuildConfiguration
+# Build Tool for Embedded Sample
- task: CmdLine@2
- displayName: Mask BuildConfiguration
- enabled: False
+ displayName: Build TestEmbedded Sample
inputs:
+ workingDirectory: $(Build.SourcesDirectory)\src\Samples\TestEmbedded
script: |
- @echo off
-
- rem Although BuildConfiguration is PipelineRelease or PipelineDebug, the build outputs still go to Release or Debug
- rem change BuildConfiguration variable so staging succeeds
- rem the alternative would be to add configuration property for Pipeline* to every project in cswinrt.sln
-
- if "$(BuildConfiguration)"=="PipelineRelease" (
- set NewBuildConfiguration=Release
- ) else if "$(BuildConfiguration)"=="PipelineDebug" (
- set NewBuildConfiguration=Debug
+ if "%VSCMD_VER%"=="" (
+ pushd c:
+ call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" >nul 2>&1
+ popd
)
- if "%NewBuildConfiguration%"!="" (
- echo ##vso[task.setvariable variable=BuildConfiguration;]%NewBuildConfiguration%
- )
+ 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)
# Component Detection
- task: ComponentGovernanceComponentDetection@0
@@ -208,6 +204,15 @@ stages:
Contents: cswinrt.binlog
TargetFolder: $(Build.ArtifactStagingDirectory)\binlog
+# Stage BinLog
+ - task: CopyFiles@2
+ displayName: Stage Embedded Sample BinLog
+ condition: always()
+ inputs:
+ SourceFolder: $(Build.SourcesDirectory)\src\Samples\TestEmbedded
+ Contents: embeddedsample.binlog
+ TargetFolder: $(Build.ArtifactStagingDirectory)\binlog
+
# Publish BinLog
- task: PublishBuildArtifacts@1
displayName: Publish BinLog
@@ -264,7 +269,6 @@ stages:
Contents: |
WinRT.Host.dll
WinRT.Host.pdb
- WinRT.Host.dll.mui
TargetFolder: $(Build.ArtifactStagingDirectory)\native
# Stage Unit Test
@@ -401,10 +405,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
@@ -421,6 +435,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
@@ -446,7 +468,6 @@ stages:
exit /b 0
- job: Benchmarks
- condition: eq(variables['_RunBenchmarks'],'true')
displayName: Run Benchmarks
dependsOn: []
pool:
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.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..082f6c2d8 100644
--- a/src/Samples/TestEmbedded/Directory.Build.targets
+++ b/src/Samples/TestEmbedded/Directory.Build.targets
@@ -1,2 +1,125 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(WinRTRuntimeSourcesDir)TypeNameSupport.cs;
+ $(WinRTRuntimeSourcesDir)TypeExtensions.cs;
+ $(WinRTRuntimeSourcesDir)Projections.cs;
+ $(WinRTRuntimeSourcesDir)ObjectReference.cs;
+ $(WinRTRuntimeSourcesDir)MonoSupport.cs;
+ $(WinRTRuntimeSourcesDir)Module.cs;
+ $(WinRTRuntimeSourcesDir)Marshalers.cs;
+ $(WinRTRuntimeSourcesDir)IInspectable.cs;
+ $(WinRTRuntimeSourcesDir)GuidGenerator.cs;
+ $(WinRTRuntimeSourcesDir)FundamentalMarshalers.cs;
+ $(WinRTRuntimeSourcesDir)ExceptionHelpers.cs;
+ $(WinRTRuntimeSourcesDir)EventRegistrationToken.cs;
+ $(WinRTRuntimeSourcesDir)DerivedComposed.cs;
+ $(WinRTRuntimeSourcesDir)Context.cs;
+ $(WinRTRuntimeSourcesDir)ComWrappersSupport.cs;
+ $(WinRTRuntimeSourcesDir)CastExtensions.cs;
+ $(WinRTRuntimeSourcesDir)Attributes.cs;
+ $(WinRTRuntimeSourcesDir)AgileReference.cs;
+ $(WinRTRuntimeSourcesDir)Projections\EventHandler.cs;
+ $(WinRTRuntimeSourcesDir)Projections\Geometry.cs;
+ $(WinRTRuntimeSourcesDir)Projections\IStringable.cs;
+ $(WinRTRuntimeSourcesDir)Projections\KeyValuePair.cs;
+ $(WinRTRuntimeSourcesDir)Projections\NotifyCollectionChangedAction.cs;
+ $(WinRTRuntimeSourcesDir)Projections\NotifyCollectionChangedEventArgs.cs;
+ $(WinRTRuntimeSourcesDir)Projections\NotifyCollectionChangedEventHandler.cs;
+ $(WinRTRuntimeSourcesDir)Projections\Nullable.cs;
+ $(WinRTRuntimeSourcesDir)Projections\Numerics.cs;
+ $(WinRTRuntimeSourcesDir)Projections\PropertyChangedEventArgs.cs;
+ $(WinRTRuntimeSourcesDir)Projections\PropertyChangedEventHandler.cs;
+ $(WinRTRuntimeSourcesDir)Projections\SystemTypes.cs;
+ $(WinRTRuntimeSourcesDir)Projections\Type.cs;
+ $(WinRTRuntimeSourcesDir)Projections\Uri.cs;
+ $(WinRTRuntimeSourcesDir)Projections\DataErrorsChangedEventArgs.cs;
+ $(WinRTRuntimeSourcesDir)Interop\IReferenceTracker.cs;
+ $(WinRTRuntimeSourcesDir)Interop\IUnknownVftbl.cs;
+ $(WinRTRuntimeSourcesDir)Interop\StandardDelegates.cs;
+ $(WinRTRuntimeSourcesDir)Interop\ExceptionErrorInfo.cs;
+ $(WinRTRuntimeSourcesDir)Interop\IActivationFactory.cs;
+ $(WinRTRuntimeSourcesDir)Interop\IContextCallback.cs;
+ $(WinRTRuntimeSourcesDir)Interop\IMarshal.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..55430a277 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);
+ public TestLib()
+ {
}
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
diff --git a/src/build.cmd b/src/build.cmd
index 84825f629..072daeeda 100644
--- a/src/build.cmd
+++ b/src/build.cmd
@@ -1,262 +1,261 @@
-@echo off
-if /i "%cswinrt_echo%" == "on" @echo on
-
-set CsWinRTBuildNetSDKVersion=6.0.101
-set CsWinRTNet5SdkVersion=5.0.404
-set this_dir=%~dp0
-
-:dotnet
-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%
-set DownloadTimeout=1200
-
-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'))) ^
--Version '%CsWinRTNet5SdkVersion%' -InstallDir '%DOTNET_ROOT%' -Architecture 'x64' -DownloadTimeout %DownloadTimeout% ^
--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 '%CsWinRTNet5SdkVersion%' -InstallDir '%DOTNET_ROOT(86)%' -Architecture 'x86' -DownloadTimeout %DownloadTimeout% ^
--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' -DownloadTimeout %DownloadTimeout% ^
--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' -DownloadTimeout %DownloadTimeout% ^
--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": "%CsWinRTBuildNetSDKVersion%", >> %global_json%
-echo "allowPrerelease": true >> %global_json%
-echo } >> %global_json%
-echo } >> %global_json%
-
-rem Preserve above for Visual Studio launch inheritance
-setlocal ENABLEDELAYEDEXPANSION
-
-:params
-set cswinrt_platform=%1
-set cswinrt_configuration=%2
-set cswinrt_version_number=%3
-set cswinrt_version_string=%4
-set cswinrt_assembly_version=%5
-set "%6"!="" set cswinrt_label=%6
-
-if "%cswinrt_platform%"=="" set cswinrt_platform=x64
-
-if /I "%cswinrt_platform%" equ "all" (
- if "%cswinrt_configuration%"=="" (
- set cswinrt_configuration=all
- )
- call %0 x86 !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
- call %0 x64 !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
- call %0 arm !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
- call %0 arm64 !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
- goto :eof
-)
-
-if /I "%cswinrt_configuration%" equ "all" (
- call %0 %cswinrt_platform% Debug !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
- call %0 %cswinrt_platform% Release !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
- goto :eof
-)
-
-if "%cswinrt_configuration%"=="" (
- set cswinrt_configuration=Release
-)
-
-if "%cswinrt_version_number%"=="" set cswinrt_version_number=0.0.0.0
-if "%cswinrt_version_string%"=="" set cswinrt_version_string=0.0.0-private.0
-if "%cswinrt_assembly_version%"=="" set cswinrt_assembly_version=0.0.0.0
-
-if "%cswinrt_baseline_breaking_compat_errors%"=="" set cswinrt_baseline_breaking_compat_errors=false
-if "%cswinrt_baseline_assembly_version_compat_errors%"=="" set cswinrt_baseline_assembly_version_compat_errors=false
-
-rem Generate prerelease targets file to exercise build warnings
-set prerelease_targets=%this_dir%..\nuget\Microsoft.Windows.CsWinRT.Prerelease.targets
-rem Create default %prerelease_targets%
-echo ^ > %prerelease_targets%
-echo ^> %prerelease_targets%
-echo Condition="'$(NetCoreSdkVersion)' ^!= '%CsWinRTNet5SdkVersion%' and '$(Net5SdkVersion)' ^!= '%CsWinRTNet5SdkVersion%'"^> >> %prerelease_targets%
-echo ^ >> %prerelease_targets%
-echo ^ >> %prerelease_targets%
-echo ^ >> %prerelease_targets%
-
-goto :skip_build_tools
-rem VS 16.X BuildTools support (when a prerelease VS is required, until it is deployed to Azure Devops agents)
-msbuild -ver | findstr 16.X >nul
-if ErrorLevel 1 (
- echo Using VS Build Tools 16.X
- if %cswinrt_platform%==x86 (
- set msbuild_path="%this_dir%.buildtools\MSBuild\Current\Bin\\"
- ) else (
- set msbuild_path="%this_dir%.buildtools\MSBuild\Current\Bin\amd64\\"
- )
- if not exist !msbuild_path! (
- if not exist .buildtools md .buildtools
- powershell -NoProfile -ExecutionPolicy unrestricted -File .\get_buildtools.ps1
- )
- set nuget_params=-MSBuildPath !msbuild_path!
-) else (
- set msbuild_path=
- set nuget_params=
-)
-:skip_build_tools
-
-set nuget_dir=%this_dir%.nuget
-
-if not "%cswinrt_label%"=="" goto %cswinrt_label%
-
-: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
-rem Note: packages.config-based (vcxproj) projects do not support msbuild /t:restore
-call %this_dir%get_testwinrt.cmd
-set NUGET_RESTORE_MSBUILD_ARGS=/p:platform="%cswinrt_platform%"
-call :exec %nuget_dir%\nuget.exe restore %nuget_params% %this_dir%cswinrt.sln
-rem: Calling nuget restore again on ObjectLifetimeTests.Lifted.csproj to prevent .props from \microsoft.testplatform.testhost\build\netcoreapp2.1 from being included. Nuget.exe erroneously imports props files. https://github.com/NuGet/Home/issues/9672
-call :exec %msbuild_path%msbuild.exe %this_dir%\Tests\ObjectLifetimeTests\ObjectLifetimeTests.Lifted.csproj /t:restore /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%
-
-:build
-echo Building cswinrt for %cswinrt_platform% %cswinrt_configuration%
-call :exec %msbuild_path%msbuild.exe %cswinrt_build_params% /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%;VersionNumber=%cswinrt_version_number%;VersionString=%cswinrt_version_string%;AssemblyVersionNumber=%cswinrt_assembly_version%;GenerateTestProjection=true;BaselineAllAPICompatError=%cswinrt_baseline_breaking_compat_errors%;BaselineAllMatchingRefApiCompatError=%cswinrt_baseline_assembly_version_compat_errors% %this_dir%cswinrt.sln
-if ErrorLevel 1 (
- echo.
- echo ERROR: Build failed
- exit /b !ErrorLevel!
-)
-if "%cswinrt_build_only%"=="true" goto :eof
-
-:buildembedded
-echo Building embedded sample for %cswinrt_platform% %cswinrt_configuration%
-call :exec %nuget_dir%\nuget.exe restore %nuget_params% %this_dir%Samples\TestEmbedded\TestEmbedded.sln
-call :exec %msbuild_path%msbuild.exe %this_dir%\Samples\TestEmbedded\TestEmbedded.sln /t:restore /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%
-call :exec %msbuild_path%msbuild.exe %this_dir%\Samples\TestEmbedded\TestEmbedded.sln /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration% /bl:embeddedsample.binlog
-if ErrorLevel 1 (
- echo.
- echo ERROR: Embedded build failed
- exit /b !ErrorLevel!
-)
-
-rem Tests are not yet enabled for ARM builds (not supported by Project Reunion)
-if %cswinrt_platform%==arm goto :package
-if %cswinrt_platform%==arm64 goto :package
-
-:test
-rem Build/Run xUnit tests, generating xml output report for Azure Devops reporting, via XunitXml.TestLogger NuGet
-if %cswinrt_platform%==x86 (
- set dotnet_exe="%DOTNET_ROOT(86)%\dotnet.exe"
-) else (
- set dotnet_exe="%DOTNET_ROOT%\dotnet.exe"
-)
-if not exist %dotnet_exe% (
- if %cswinrt_platform%==x86 (
- set dotnet_exe="%ProgramFiles(x86)%\dotnet\dotnet.exe"
- ) else (
- set dotnet_exe="%ProgramFiles%\dotnet\dotnet.exe"
- )
-)
-
-:embeddedtests
-:: build the embedded sample and run the unittest
-call :exec %dotnet_exe% test --verbosity normal --no-build --logger xunit;LogFilePath=%~dp0embedunittest_%cswinrt_version_string%.xml %this_dir%Samples/TestEmbedded/UnitTestEmbedded/UnitTestEmbedded.csproj /nologo /m /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%
-if ErrorLevel 1 (
- echo.
- echo ERROR: Embedded unit test failed, skipping NuGet pack
- exit /b !ErrorLevel!
-)
-
-:objectlifetimetests
-rem Running Object Lifetime Unit Tests
-echo Running object lifetime tests for %cswinrt_platform% %cswinrt_configuration%
-if '%NUGET_PACKAGES%'=='' set NUGET_PACKAGES=%USERPROFILE%\.nuget\packages
-call :exec vstest.console.exe %this_dir%\Tests\ObjectLifetimeTests\bin\%cswinrt_platform%\%cswinrt_configuration%\net5.0-windows10.0.19041.0\win10-%cswinrt_platform%\ObjectLifetimeTests.Lifted.build.appxrecipe /TestAdapterPath:"%NUGET_PACKAGES%\mstest.testadapter\2.2.4-preview-20210513-02\build\_common" /framework:FrameworkUap10 /logger:trx;LogFileName=%this_dir%\VsTestResults.trx
-if ErrorLevel 1 (
- echo.
- echo ERROR: Lifetime test failed, skipping NuGet pack
- exit /b !ErrorLevel!
-)
-
-:unittest
-rem WinUI NuGet package's Microsoft.WinUI.AppX.targets attempts to import a file that does not exist, even when
-rem executing "dotnet test --no-build ...", which evidently still needs to parse and load the entire project.
-rem Work around by using a dummy targets file and assigning it to the MsAppxPackageTargets property.
-echo Running cswinrt unit tests for %cswinrt_platform% %cswinrt_configuration%
-echo ^ > %temp%\EmptyMsAppxPackage.Targets
-call :exec %dotnet_exe% test --verbosity normal --no-build --logger xunit;LogFilePath=%~dp0unittest_%cswinrt_version_string%.xml %this_dir%Tests/unittest/UnitTest.csproj /nologo /m /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%;MsAppxPackageTargets=%temp%\EmptyMsAppxPackage.Targets
-if ErrorLevel 1 (
- echo.
- echo ERROR: Unit test failed, skipping NuGet pack
- exit /b !ErrorLevel!
-)
-
-:hosttest
-rem Run WinRT.Host tests
-echo Running cswinrt host tests for %cswinrt_platform% %cswinrt_configuration%
-call :exec %this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\HostTest\bin\HostTest.exe --gtest_output=xml:%this_dir%hosttest_%cswinrt_version_string%.xml
-if ErrorLevel 1 (
- echo.
- echo ERROR: Host test failed, skipping NuGet pack
- exit /b !ErrorLevel!
-)
-
-:authortest
-rem Run Authoring tests
-echo Running cswinrt authoring tests for %cswinrt_platform% %cswinrt_configuration%
-call :exec %this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\AuthoringConsumptionTest\bin\AuthoringConsumptionTest.exe --gtest_output=xml:%this_dir%hosttest_%cswinrt_version_string%.xml
-if ErrorLevel 1 (
- echo.
- echo ERROR: Authoring test failed, skipping NuGet pack
- exit /b !ErrorLevel!
-)
-
-:package
-rem We set the properties of the CsWinRT.nuspec here, and pass them as the -Properties option when we call `nuget pack`
-set cswinrt_bin_dir=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\cswinrt\bin\
-set cswinrt_exe=%cswinrt_bin_dir%cswinrt.exe
-set interop_winmd=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\cswinrt\obj\merged\WinRT.Interop.winmd
-set netstandard2_runtime=%this_dir%WinRT.Runtime\bin\%cswinrt_configuration%\netstandard2.0\WinRT.Runtime.dll
-set net5_runtime=%this_dir%WinRT.Runtime\bin\%cswinrt_configuration%\net5.0\WinRT.Runtime.dll
-set source_generator=%this_dir%Authoring\WinRT.SourceGenerator\bin\%cswinrt_configuration%\netstandard2.0\WinRT.SourceGenerator.dll
-set winrt_host_%cswinrt_platform%=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\WinRT.Host\bin\WinRT.Host.dll
-set winrt_host_resource_%cswinrt_platform%=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\WinRT.Host\bin\WinRT.Host.dll.mui
-set winrt_shim=%this_dir%Authoring\WinRT.Host.Shim\bin\%cswinrt_configuration%\net5.0\WinRT.Host.Shim.dll
-set guid_patch=%this_dir%Perf\IIDOptimizer\bin\%cswinrt_configuration%\net5.0\*.*
-rem Now call pack
-echo Creating nuget package
-call :exec %nuget_dir%\nuget pack %this_dir%..\nuget\Microsoft.Windows.CsWinRT.nuspec -Properties cswinrt_exe=%cswinrt_exe%;interop_winmd=%interop_winmd%;netstandard2_runtime=%netstandard2_runtime%;net5_runtime=%net5_runtime%;source_generator=%source_generator%;cswinrt_nuget_version=%cswinrt_version_string%;winrt_host_x86=%winrt_host_x86%;winrt_host_x64=%winrt_host_x64%;winrt_host_arm=%winrt_host_arm%;winrt_host_arm64=%winrt_host_arm64%;winrt_host_resource_x86=%winrt_host_resource_x86%;winrt_host_resource_x64=%winrt_host_resource_x64%;winrt_host_resource_arm=%winrt_host_resource_arm%;winrt_host_resource_arm64=%winrt_host_resource_arm64%;winrt_shim=%winrt_shim%;guid_patch=%guid_patch% -OutputDirectory %cswinrt_bin_dir% -NonInteractive -Verbosity Detailed -NoPackageAnalysis
-goto :eof
-
-:exec
-if /i "%cswinrt_echo%" == "only" (
-echo Command Line:
-echo %*
-echo.
-) else (
-%*
-)
-goto :eof
-
+@echo off
+if /i "%cswinrt_echo%" == "on" @echo on
+
+set CsWinRTBuildNetSDKVersion=6.0.101
+set CsWinRTNet5SdkVersion=5.0.404
+set this_dir=%~dp0
+
+:dotnet
+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%
+set DownloadTimeout=1200
+
+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'))) ^
+-Version '%CsWinRTNet5SdkVersion%' -InstallDir '%DOTNET_ROOT%' -Architecture 'x64' -DownloadTimeout %DownloadTimeout% ^
+-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 '%CsWinRTNet5SdkVersion%' -InstallDir '%DOTNET_ROOT(86)%' -Architecture 'x86' -DownloadTimeout %DownloadTimeout% ^
+-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' -DownloadTimeout %DownloadTimeout% ^
+-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' -DownloadTimeout %DownloadTimeout% ^
+-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": "%CsWinRTBuildNetSDKVersion%", >> %global_json%
+echo "allowPrerelease": true >> %global_json%
+echo } >> %global_json%
+echo } >> %global_json%
+
+rem Preserve above for Visual Studio launch inheritance
+setlocal ENABLEDELAYEDEXPANSION
+
+:params
+set cswinrt_platform=%1
+set cswinrt_configuration=%2
+set cswinrt_version_number=%3
+set cswinrt_version_string=%4
+set cswinrt_assembly_version=%5
+set "%6"!="" set cswinrt_label=%6
+
+if "%cswinrt_platform%"=="" set cswinrt_platform=x64
+
+if /I "%cswinrt_platform%" equ "all" (
+ if "%cswinrt_configuration%"=="" (
+ set cswinrt_configuration=all
+ )
+ call %0 x86 !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
+ call %0 x64 !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
+ call %0 arm !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
+ call %0 arm64 !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
+ goto :eof
+)
+
+if /I "%cswinrt_configuration%" equ "all" (
+ call %0 %cswinrt_platform% Debug !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
+ call %0 %cswinrt_platform% Release !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
+ goto :eof
+)
+
+if "%cswinrt_configuration%"=="" (
+ set cswinrt_configuration=Release
+)
+
+if "%cswinrt_version_number%"=="" set cswinrt_version_number=0.0.0.0
+if "%cswinrt_version_string%"=="" set cswinrt_version_string=0.0.0-private.0
+if "%cswinrt_assembly_version%"=="" set cswinrt_assembly_version=0.0.0.0
+
+if "%cswinrt_baseline_breaking_compat_errors%"=="" set cswinrt_baseline_breaking_compat_errors=false
+if "%cswinrt_baseline_assembly_version_compat_errors%"=="" set cswinrt_baseline_assembly_version_compat_errors=false
+
+rem Generate prerelease targets file to exercise build warnings
+set prerelease_targets=%this_dir%..\nuget\Microsoft.Windows.CsWinRT.Prerelease.targets
+rem Create default %prerelease_targets%
+echo ^ > %prerelease_targets%
+echo ^> %prerelease_targets%
+echo Condition="'$(NetCoreSdkVersion)' ^!= '%CsWinRTNet5SdkVersion%' and '$(Net5SdkVersion)' ^!= '%CsWinRTNet5SdkVersion%'"^> >> %prerelease_targets%
+echo ^ >> %prerelease_targets%
+echo ^ >> %prerelease_targets%
+echo ^ >> %prerelease_targets%
+
+goto :skip_build_tools
+rem VS 16.X BuildTools support (when a prerelease VS is required, until it is deployed to Azure Devops agents)
+msbuild -ver | findstr 16.X >nul
+if ErrorLevel 1 (
+ echo Using VS Build Tools 16.X
+ if %cswinrt_platform%==x86 (
+ set msbuild_path="%this_dir%.buildtools\MSBuild\Current\Bin\\"
+ ) else (
+ set msbuild_path="%this_dir%.buildtools\MSBuild\Current\Bin\amd64\\"
+ )
+ if not exist !msbuild_path! (
+ if not exist .buildtools md .buildtools
+ powershell -NoProfile -ExecutionPolicy unrestricted -File .\get_buildtools.ps1
+ )
+ set nuget_params=-MSBuildPath !msbuild_path!
+) else (
+ set msbuild_path=
+ set nuget_params=
+)
+:skip_build_tools
+
+set nuget_dir=%this_dir%.nuget
+
+if not "%cswinrt_label%"=="" goto %cswinrt_label%
+
+: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
+rem Note: packages.config-based (vcxproj) projects do not support msbuild /t:restore
+call %this_dir%get_testwinrt.cmd
+set NUGET_RESTORE_MSBUILD_ARGS=/p:platform="%cswinrt_platform%"
+call :exec %nuget_dir%\nuget.exe restore %nuget_params% %this_dir%cswinrt.sln
+rem: Calling nuget restore again on ObjectLifetimeTests.Lifted.csproj to prevent .props from \microsoft.testplatform.testhost\build\netcoreapp2.1 from being included. Nuget.exe erroneously imports props files. https://github.com/NuGet/Home/issues/9672
+call :exec %msbuild_path%msbuild.exe %this_dir%\Tests\ObjectLifetimeTests\ObjectLifetimeTests.Lifted.csproj /t:restore /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%
+
+:build
+echo Building cswinrt for %cswinrt_platform% %cswinrt_configuration%
+call :exec %msbuild_path%msbuild.exe %cswinrt_build_params% /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%;VersionNumber=%cswinrt_version_number%;VersionString=%cswinrt_version_string%;AssemblyVersionNumber=%cswinrt_assembly_version%;GenerateTestProjection=true;BaselineAllAPICompatError=%cswinrt_baseline_breaking_compat_errors%;BaselineAllMatchingRefApiCompatError=%cswinrt_baseline_assembly_version_compat_errors% %this_dir%cswinrt.sln
+if ErrorLevel 1 (
+ echo.
+ echo ERROR: Build failed
+ exit /b !ErrorLevel!
+)
+if "%cswinrt_build_only%"=="true" goto :eof
+
+
+:: :buildembedded
+echo Building embedded sample for %cswinrt_platform% %cswinrt_configuration%
+call :exec %nuget_dir%\nuget.exe restore %nuget_params% %this_dir%Samples\TestEmbedded\TestEmbedded.sln
+call :exec %msbuild_path%msbuild.exe /p:platform=%build_platform%;configuration=%build_configuration% /bl:embeddedsample.binlog %this_dir%Samples\TestEmbedded\TestEmbedded.sln
+if ErrorLevel 1 (
+ echo.
+ echo ERROR: Embedded build failed
+ exit /b !ErrorLevel!
+)
+
+rem Tests are not yet enabled for ARM builds (not supported by Project Reunion)
+if %cswinrt_platform%==arm goto :eof
+if %cswinrt_platform%==arm64 goto :eof
+
+:test
+rem Build/Run xUnit tests, generating xml output report for Azure Devops reporting, via XunitXml.TestLogger NuGet
+if %cswinrt_platform%==x86 (
+ set dotnet_exe="%DOTNET_ROOT(86)%\dotnet.exe"
+) else (
+ set dotnet_exe="%DOTNET_ROOT%\dotnet.exe"
+)
+if not exist %dotnet_exe% (
+ if %cswinrt_platform%==x86 (
+ set dotnet_exe="%ProgramFiles(x86)%\dotnet\dotnet.exe"
+ ) else (
+ set dotnet_exe="%ProgramFiles%\dotnet\dotnet.exe"
+ )
+)
+
+:embeddedtests
+:: build the embedded sample and run the unittest
+call :exec %dotnet_exe% test --verbosity normal --no-build --logger xunit;LogFilePath=%~dp0embedunittest_%cswinrt_version_string%.xml %this_dir%Samples/TestEmbedded/UnitTestEmbedded/UnitTestEmbedded.csproj /nologo /m /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%
+if ErrorLevel 1 (
+ echo.
+ echo ERROR: Embedded unit test failed, exiting early
+ exit /b !ErrorLevel!
+)
+
+:objectlifetimetests
+rem Running Object Lifetime Unit Tests
+echo Running object lifetime tests for %cswinrt_platform% %cswinrt_configuration%
+if '%NUGET_PACKAGES%'=='' set NUGET_PACKAGES=%USERPROFILE%\.nuget\packages
+call :exec vstest.console.exe %this_dir%\Tests\ObjectLifetimeTests\bin\%cswinrt_platform%\%cswinrt_configuration%\net5.0-windows10.0.19041.0\win10-%cswinrt_platform%\ObjectLifetimeTests.Lifted.build.appxrecipe /TestAdapterPath:"%NUGET_PACKAGES%\mstest.testadapter\2.2.4-preview-20210513-02\build\_common" /framework:FrameworkUap10 /logger:trx;LogFileName=%this_dir%\VsTestResults.trx
+if ErrorLevel 1 (
+ echo.
+ echo ERROR: Lifetime test failed, skipping NuGet pack
+ exit /b !ErrorLevel!
+)
+
+:unittest
+rem WinUI NuGet package's Microsoft.WinUI.AppX.targets attempts to import a file that does not exist, even when
+rem executing "dotnet test --no-build ...", which evidently still needs to parse and load the entire project.
+rem Work around by using a dummy targets file and assigning it to the MsAppxPackageTargets property.
+echo Running cswinrt unit tests for %cswinrt_platform% %cswinrt_configuration%
+echo ^ > %temp%\EmptyMsAppxPackage.Targets
+call :exec %dotnet_exe% test --verbosity normal --no-build --logger xunit;LogFilePath=%~dp0unittest_%cswinrt_version_string%.xml %this_dir%Tests/unittest/UnitTest.csproj /nologo /m /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%;MsAppxPackageTargets=%temp%\EmptyMsAppxPackage.Targets
+if ErrorLevel 1 (
+ echo.
+ echo ERROR: Unit test failed, skipping NuGet pack
+ exit /b !ErrorLevel!
+)
+
+:hosttest
+rem Run WinRT.Host tests
+echo Running cswinrt host tests for %cswinrt_platform% %cswinrt_configuration%
+call :exec %this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\HostTest\bin\HostTest.exe --gtest_output=xml:%this_dir%hosttest_%cswinrt_version_string%.xml
+if ErrorLevel 1 (
+ echo.
+ echo ERROR: Host test failed, skipping NuGet pack
+ exit /b !ErrorLevel!
+)
+
+:authortest
+rem Run Authoring tests
+echo Running cswinrt authoring tests for %cswinrt_platform% %cswinrt_configuration%
+call :exec %this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\AuthoringConsumptionTest\bin\AuthoringConsumptionTest.exe --gtest_output=xml:%this_dir%hosttest_%cswinrt_version_string%.xml
+if ErrorLevel 1 (
+ echo.
+ echo ERROR: Authoring test failed, skipping NuGet pack
+ exit /b !ErrorLevel!
+)
+
+:package
+rem We set the properties of the CsWinRT.nuspec here, and pass them as the -Properties option when we call `nuget pack`
+set cswinrt_bin_dir=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\cswinrt\bin\
+set cswinrt_exe=%cswinrt_bin_dir%cswinrt.exe
+set interop_winmd=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\cswinrt\obj\merged\WinRT.Interop.winmd
+set netstandard2_runtime=%this_dir%WinRT.Runtime\bin\%cswinrt_configuration%\netstandard2.0\WinRT.Runtime.dll
+set net5_runtime=%this_dir%WinRT.Runtime\bin\%cswinrt_configuration%\net5.0\WinRT.Runtime.dll
+set source_generator=%this_dir%Authoring\WinRT.SourceGenerator\bin\%cswinrt_configuration%\netstandard2.0\WinRT.SourceGenerator.dll
+set winrt_host_%cswinrt_platform%=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\WinRT.Host\bin\WinRT.Host.dll
+set winrt_shim=%this_dir%Authoring\WinRT.Host.Shim\bin\%cswinrt_configuration%\net5.0\WinRT.Host.Shim.dll
+set guid_patch=%this_dir%Perf\IIDOptimizer\bin\%cswinrt_configuration%\net5.0\*.*
+rem Now call pack
+echo Creating nuget package
+call :exec %nuget_dir%\nuget pack %this_dir%..\nuget\Microsoft.Windows.CsWinRT.nuspec -Properties cswinrt_exe=%cswinrt_exe%;interop_winmd=%interop_winmd%;netstandard2_runtime=%netstandard2_runtime%;net5_runtime=%net5_runtime%;source_generator=%source_generator%;cswinrt_nuget_version=%cswinrt_version_string%;winrt_host_x86=%winrt_host_x86%;winrt_host_x64=%winrt_host_x64%;winrt_host_arm=%winrt_host_arm%;winrt_host_arm64=%winrt_host_arm64%;winrt_shim=%winrt_shim%;guid_patch=%guid_patch% -OutputDirectory %cswinrt_bin_dir% -NonInteractive -Verbosity Detailed -NoPackageAnalysis
+goto :eof
+
+:exec
+if /i "%cswinrt_echo%" == "only" (
+echo Command Line:
+echo %*
+echo.
+) else (
+%*
+)
+goto :eof
+
From 23f59d71d8ef19c01104994ff2068e4ab7635be5 Mon Sep 17 00:00:00 2001
From: Joshua Larkin <70237359+j0shuams@users.noreply.github.com>
Date: Tue, 5 Apr 2022 20:38:06 -0700
Subject: [PATCH 2/6] missing winrt src file
---
src/Samples/TestEmbedded/Directory.Build.targets | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Samples/TestEmbedded/Directory.Build.targets b/src/Samples/TestEmbedded/Directory.Build.targets
index 082f6c2d8..0acdcad35 100644
--- a/src/Samples/TestEmbedded/Directory.Build.targets
+++ b/src/Samples/TestEmbedded/Directory.Build.targets
@@ -43,6 +43,7 @@
$(WinRTRuntimeSourcesDir)CastExtensions.cs;
$(WinRTRuntimeSourcesDir)Attributes.cs;
$(WinRTRuntimeSourcesDir)AgileReference.cs;
+ $(WinRTRuntimeSourcesDir)WinRTRuntimeErrorStrings.Designer.cs;
$(WinRTRuntimeSourcesDir)Projections\EventHandler.cs;
$(WinRTRuntimeSourcesDir)Projections\Geometry.cs;
$(WinRTRuntimeSourcesDir)Projections\IStringable.cs;
From fcb4a989498acf174c9c05df4eb48f5f24adda03 Mon Sep 17 00:00:00 2001
From: Joshua Larkin <70237359+j0shuams@users.noreply.github.com>
Date: Wed, 6 Apr 2022 09:16:22 -0700
Subject: [PATCH 3/6] patch
---
.../CsWinRT-BuildAndTest-Stage.yml | 2 +
.../TestEmbedded/Directory.Build.targets | 5 -
src/build.cmd | 523 +++++++++---------
3 files changed, 264 insertions(+), 266 deletions(-)
diff --git a/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml b/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml
index 8d5766919..5f399903b 100644
--- a/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml
+++ b/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml
@@ -269,6 +269,7 @@ stages:
Contents: |
WinRT.Host.dll
WinRT.Host.pdb
+ WinRT.Host.dll.mui
TargetFolder: $(Build.ArtifactStagingDirectory)\native
# Stage Unit Test
@@ -469,6 +470,7 @@ stages:
- job: Benchmarks
displayName: Run Benchmarks
+ condition: eq(variables['_RunBenchmarks'],'true')
dependsOn: []
pool:
vmImage: windows-2019
diff --git a/src/Samples/TestEmbedded/Directory.Build.targets b/src/Samples/TestEmbedded/Directory.Build.targets
index 0acdcad35..1c99dc4f6 100644
--- a/src/Samples/TestEmbedded/Directory.Build.targets
+++ b/src/Samples/TestEmbedded/Directory.Build.targets
@@ -20,9 +20,6 @@
AfterTargets="CsWinRTGenerateProjection"
BeforeTargets="CsWinRTIncludeProjection">
-
-
-
$(WinRTRuntimeSourcesDir)TypeNameSupport.cs;
@@ -75,8 +72,6 @@
-
-
%global_json%
-echo "sdk": { >> %global_json%
-echo "version": "%CsWinRTBuildNetSDKVersion%", >> %global_json%
-echo "allowPrerelease": true >> %global_json%
-echo } >> %global_json%
-echo } >> %global_json%
-
-rem Preserve above for Visual Studio launch inheritance
-setlocal ENABLEDELAYEDEXPANSION
-
-:params
-set cswinrt_platform=%1
-set cswinrt_configuration=%2
-set cswinrt_version_number=%3
-set cswinrt_version_string=%4
-set cswinrt_assembly_version=%5
-set "%6"!="" set cswinrt_label=%6
-
-if "%cswinrt_platform%"=="" set cswinrt_platform=x64
-
-if /I "%cswinrt_platform%" equ "all" (
- if "%cswinrt_configuration%"=="" (
- set cswinrt_configuration=all
- )
- call %0 x86 !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
- call %0 x64 !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
- call %0 arm !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
- call %0 arm64 !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
- goto :eof
-)
-
-if /I "%cswinrt_configuration%" equ "all" (
- call %0 %cswinrt_platform% Debug !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
- call %0 %cswinrt_platform% Release !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
- goto :eof
-)
-
-if "%cswinrt_configuration%"=="" (
- set cswinrt_configuration=Release
-)
-
-if "%cswinrt_version_number%"=="" set cswinrt_version_number=0.0.0.0
-if "%cswinrt_version_string%"=="" set cswinrt_version_string=0.0.0-private.0
-if "%cswinrt_assembly_version%"=="" set cswinrt_assembly_version=0.0.0.0
-
-if "%cswinrt_baseline_breaking_compat_errors%"=="" set cswinrt_baseline_breaking_compat_errors=false
-if "%cswinrt_baseline_assembly_version_compat_errors%"=="" set cswinrt_baseline_assembly_version_compat_errors=false
-
-rem Generate prerelease targets file to exercise build warnings
-set prerelease_targets=%this_dir%..\nuget\Microsoft.Windows.CsWinRT.Prerelease.targets
-rem Create default %prerelease_targets%
-echo ^ > %prerelease_targets%
-echo ^> %prerelease_targets%
-echo Condition="'$(NetCoreSdkVersion)' ^!= '%CsWinRTNet5SdkVersion%' and '$(Net5SdkVersion)' ^!= '%CsWinRTNet5SdkVersion%'"^> >> %prerelease_targets%
-echo ^ >> %prerelease_targets%
-echo ^ >> %prerelease_targets%
-echo ^ >> %prerelease_targets%
-
-goto :skip_build_tools
-rem VS 16.X BuildTools support (when a prerelease VS is required, until it is deployed to Azure Devops agents)
-msbuild -ver | findstr 16.X >nul
-if ErrorLevel 1 (
- echo Using VS Build Tools 16.X
- if %cswinrt_platform%==x86 (
- set msbuild_path="%this_dir%.buildtools\MSBuild\Current\Bin\\"
- ) else (
- set msbuild_path="%this_dir%.buildtools\MSBuild\Current\Bin\amd64\\"
- )
- if not exist !msbuild_path! (
- if not exist .buildtools md .buildtools
- powershell -NoProfile -ExecutionPolicy unrestricted -File .\get_buildtools.ps1
- )
- set nuget_params=-MSBuildPath !msbuild_path!
-) else (
- set msbuild_path=
- set nuget_params=
-)
-:skip_build_tools
-
-set nuget_dir=%this_dir%.nuget
-
-if not "%cswinrt_label%"=="" goto %cswinrt_label%
-
-: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
-rem Note: packages.config-based (vcxproj) projects do not support msbuild /t:restore
-call %this_dir%get_testwinrt.cmd
-set NUGET_RESTORE_MSBUILD_ARGS=/p:platform="%cswinrt_platform%"
-call :exec %nuget_dir%\nuget.exe restore %nuget_params% %this_dir%cswinrt.sln
-rem: Calling nuget restore again on ObjectLifetimeTests.Lifted.csproj to prevent .props from \microsoft.testplatform.testhost\build\netcoreapp2.1 from being included. Nuget.exe erroneously imports props files. https://github.com/NuGet/Home/issues/9672
-call :exec %msbuild_path%msbuild.exe %this_dir%\Tests\ObjectLifetimeTests\ObjectLifetimeTests.Lifted.csproj /t:restore /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%
-
-:build
-echo Building cswinrt for %cswinrt_platform% %cswinrt_configuration%
-call :exec %msbuild_path%msbuild.exe %cswinrt_build_params% /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%;VersionNumber=%cswinrt_version_number%;VersionString=%cswinrt_version_string%;AssemblyVersionNumber=%cswinrt_assembly_version%;GenerateTestProjection=true;BaselineAllAPICompatError=%cswinrt_baseline_breaking_compat_errors%;BaselineAllMatchingRefApiCompatError=%cswinrt_baseline_assembly_version_compat_errors% %this_dir%cswinrt.sln
-if ErrorLevel 1 (
- echo.
- echo ERROR: Build failed
- exit /b !ErrorLevel!
-)
-if "%cswinrt_build_only%"=="true" goto :eof
-
-
-:: :buildembedded
-echo Building embedded sample for %cswinrt_platform% %cswinrt_configuration%
-call :exec %nuget_dir%\nuget.exe restore %nuget_params% %this_dir%Samples\TestEmbedded\TestEmbedded.sln
-call :exec %msbuild_path%msbuild.exe /p:platform=%build_platform%;configuration=%build_configuration% /bl:embeddedsample.binlog %this_dir%Samples\TestEmbedded\TestEmbedded.sln
-if ErrorLevel 1 (
- echo.
- echo ERROR: Embedded build failed
- exit /b !ErrorLevel!
-)
-
-rem Tests are not yet enabled for ARM builds (not supported by Project Reunion)
-if %cswinrt_platform%==arm goto :eof
-if %cswinrt_platform%==arm64 goto :eof
-
-:test
-rem Build/Run xUnit tests, generating xml output report for Azure Devops reporting, via XunitXml.TestLogger NuGet
-if %cswinrt_platform%==x86 (
- set dotnet_exe="%DOTNET_ROOT(86)%\dotnet.exe"
-) else (
- set dotnet_exe="%DOTNET_ROOT%\dotnet.exe"
-)
-if not exist %dotnet_exe% (
- if %cswinrt_platform%==x86 (
- set dotnet_exe="%ProgramFiles(x86)%\dotnet\dotnet.exe"
- ) else (
- set dotnet_exe="%ProgramFiles%\dotnet\dotnet.exe"
- )
-)
-
-:embeddedtests
-:: build the embedded sample and run the unittest
-call :exec %dotnet_exe% test --verbosity normal --no-build --logger xunit;LogFilePath=%~dp0embedunittest_%cswinrt_version_string%.xml %this_dir%Samples/TestEmbedded/UnitTestEmbedded/UnitTestEmbedded.csproj /nologo /m /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%
-if ErrorLevel 1 (
- echo.
- echo ERROR: Embedded unit test failed, exiting early
- exit /b !ErrorLevel!
-)
-
-:objectlifetimetests
-rem Running Object Lifetime Unit Tests
-echo Running object lifetime tests for %cswinrt_platform% %cswinrt_configuration%
-if '%NUGET_PACKAGES%'=='' set NUGET_PACKAGES=%USERPROFILE%\.nuget\packages
-call :exec vstest.console.exe %this_dir%\Tests\ObjectLifetimeTests\bin\%cswinrt_platform%\%cswinrt_configuration%\net5.0-windows10.0.19041.0\win10-%cswinrt_platform%\ObjectLifetimeTests.Lifted.build.appxrecipe /TestAdapterPath:"%NUGET_PACKAGES%\mstest.testadapter\2.2.4-preview-20210513-02\build\_common" /framework:FrameworkUap10 /logger:trx;LogFileName=%this_dir%\VsTestResults.trx
-if ErrorLevel 1 (
- echo.
- echo ERROR: Lifetime test failed, skipping NuGet pack
- exit /b !ErrorLevel!
-)
-
-:unittest
-rem WinUI NuGet package's Microsoft.WinUI.AppX.targets attempts to import a file that does not exist, even when
-rem executing "dotnet test --no-build ...", which evidently still needs to parse and load the entire project.
-rem Work around by using a dummy targets file and assigning it to the MsAppxPackageTargets property.
-echo Running cswinrt unit tests for %cswinrt_platform% %cswinrt_configuration%
-echo ^ > %temp%\EmptyMsAppxPackage.Targets
-call :exec %dotnet_exe% test --verbosity normal --no-build --logger xunit;LogFilePath=%~dp0unittest_%cswinrt_version_string%.xml %this_dir%Tests/unittest/UnitTest.csproj /nologo /m /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%;MsAppxPackageTargets=%temp%\EmptyMsAppxPackage.Targets
-if ErrorLevel 1 (
- echo.
- echo ERROR: Unit test failed, skipping NuGet pack
- exit /b !ErrorLevel!
-)
-
-:hosttest
-rem Run WinRT.Host tests
-echo Running cswinrt host tests for %cswinrt_platform% %cswinrt_configuration%
-call :exec %this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\HostTest\bin\HostTest.exe --gtest_output=xml:%this_dir%hosttest_%cswinrt_version_string%.xml
-if ErrorLevel 1 (
- echo.
- echo ERROR: Host test failed, skipping NuGet pack
- exit /b !ErrorLevel!
-)
-
-:authortest
-rem Run Authoring tests
-echo Running cswinrt authoring tests for %cswinrt_platform% %cswinrt_configuration%
-call :exec %this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\AuthoringConsumptionTest\bin\AuthoringConsumptionTest.exe --gtest_output=xml:%this_dir%hosttest_%cswinrt_version_string%.xml
-if ErrorLevel 1 (
- echo.
- echo ERROR: Authoring test failed, skipping NuGet pack
- exit /b !ErrorLevel!
-)
-
-:package
-rem We set the properties of the CsWinRT.nuspec here, and pass them as the -Properties option when we call `nuget pack`
-set cswinrt_bin_dir=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\cswinrt\bin\
-set cswinrt_exe=%cswinrt_bin_dir%cswinrt.exe
-set interop_winmd=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\cswinrt\obj\merged\WinRT.Interop.winmd
-set netstandard2_runtime=%this_dir%WinRT.Runtime\bin\%cswinrt_configuration%\netstandard2.0\WinRT.Runtime.dll
-set net5_runtime=%this_dir%WinRT.Runtime\bin\%cswinrt_configuration%\net5.0\WinRT.Runtime.dll
-set source_generator=%this_dir%Authoring\WinRT.SourceGenerator\bin\%cswinrt_configuration%\netstandard2.0\WinRT.SourceGenerator.dll
-set winrt_host_%cswinrt_platform%=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\WinRT.Host\bin\WinRT.Host.dll
-set winrt_shim=%this_dir%Authoring\WinRT.Host.Shim\bin\%cswinrt_configuration%\net5.0\WinRT.Host.Shim.dll
-set guid_patch=%this_dir%Perf\IIDOptimizer\bin\%cswinrt_configuration%\net5.0\*.*
-rem Now call pack
-echo Creating nuget package
-call :exec %nuget_dir%\nuget pack %this_dir%..\nuget\Microsoft.Windows.CsWinRT.nuspec -Properties cswinrt_exe=%cswinrt_exe%;interop_winmd=%interop_winmd%;netstandard2_runtime=%netstandard2_runtime%;net5_runtime=%net5_runtime%;source_generator=%source_generator%;cswinrt_nuget_version=%cswinrt_version_string%;winrt_host_x86=%winrt_host_x86%;winrt_host_x64=%winrt_host_x64%;winrt_host_arm=%winrt_host_arm%;winrt_host_arm64=%winrt_host_arm64%;winrt_shim=%winrt_shim%;guid_patch=%guid_patch% -OutputDirectory %cswinrt_bin_dir% -NonInteractive -Verbosity Detailed -NoPackageAnalysis
-goto :eof
-
-:exec
-if /i "%cswinrt_echo%" == "only" (
-echo Command Line:
-echo %*
-echo.
-) else (
-%*
-)
-goto :eof
-
+@echo off
+if /i "%cswinrt_echo%" == "on" @echo on
+
+set CsWinRTBuildNetSDKVersion=6.0.101
+set CsWinRTNet5SdkVersion=5.0.404
+set this_dir=%~dp0
+
+:dotnet
+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%
+set DownloadTimeout=1200
+
+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'))) ^
+-Version '%CsWinRTNet5SdkVersion%' -InstallDir '%DOTNET_ROOT%' -Architecture 'x64' -DownloadTimeout %DownloadTimeout% ^
+-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 '%CsWinRTNet5SdkVersion%' -InstallDir '%DOTNET_ROOT(86)%' -Architecture 'x86' -DownloadTimeout %DownloadTimeout% ^
+-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' -DownloadTimeout %DownloadTimeout% ^
+-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' -DownloadTimeout %DownloadTimeout% ^
+-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": "%CsWinRTBuildNetSDKVersion%", >> %global_json%
+echo "allowPrerelease": true >> %global_json%
+echo } >> %global_json%
+echo } >> %global_json%
+
+rem Preserve above for Visual Studio launch inheritance
+setlocal ENABLEDELAYEDEXPANSION
+
+:params
+set cswinrt_platform=%1
+set cswinrt_configuration=%2
+set cswinrt_version_number=%3
+set cswinrt_version_string=%4
+set cswinrt_assembly_version=%5
+set "%6"!="" set cswinrt_label=%6
+
+if "%cswinrt_platform%"=="" set cswinrt_platform=x64
+
+if /I "%cswinrt_platform%" equ "all" (
+ if "%cswinrt_configuration%"=="" (
+ set cswinrt_configuration=all
+ )
+ call %0 x86 !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
+ call %0 x64 !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
+ call %0 arm !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
+ call %0 arm64 !cswinrt_configuration! !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
+ goto :eof
+)
+
+if /I "%cswinrt_configuration%" equ "all" (
+ call %0 %cswinrt_platform% Debug !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
+ call %0 %cswinrt_platform% Release !cswinrt_version_number! !cswinrt_version_string! !cswinrt_assembly_version!
+ goto :eof
+)
+
+if "%cswinrt_configuration%"=="" (
+ set cswinrt_configuration=Release
+)
+
+if "%cswinrt_version_number%"=="" set cswinrt_version_number=0.0.0.0
+if "%cswinrt_version_string%"=="" set cswinrt_version_string=0.0.0-private.0
+if "%cswinrt_assembly_version%"=="" set cswinrt_assembly_version=0.0.0.0
+
+if "%cswinrt_baseline_breaking_compat_errors%"=="" set cswinrt_baseline_breaking_compat_errors=false
+if "%cswinrt_baseline_assembly_version_compat_errors%"=="" set cswinrt_baseline_assembly_version_compat_errors=false
+
+rem Generate prerelease targets file to exercise build warnings
+set prerelease_targets=%this_dir%..\nuget\Microsoft.Windows.CsWinRT.Prerelease.targets
+rem Create default %prerelease_targets%
+echo ^ > %prerelease_targets%
+echo ^> %prerelease_targets%
+echo Condition="'$(NetCoreSdkVersion)' ^!= '%CsWinRTNet5SdkVersion%' and '$(Net5SdkVersion)' ^!= '%CsWinRTNet5SdkVersion%'"^> >> %prerelease_targets%
+echo ^ >> %prerelease_targets%
+echo ^ >> %prerelease_targets%
+echo ^ >> %prerelease_targets%
+
+goto :skip_build_tools
+rem VS 16.X BuildTools support (when a prerelease VS is required, until it is deployed to Azure Devops agents)
+msbuild -ver | findstr 16.X >nul
+if ErrorLevel 1 (
+ echo Using VS Build Tools 16.X
+ if %cswinrt_platform%==x86 (
+ set msbuild_path="%this_dir%.buildtools\MSBuild\Current\Bin\\"
+ ) else (
+ set msbuild_path="%this_dir%.buildtools\MSBuild\Current\Bin\amd64\\"
+ )
+ if not exist !msbuild_path! (
+ if not exist .buildtools md .buildtools
+ powershell -NoProfile -ExecutionPolicy unrestricted -File .\get_buildtools.ps1
+ )
+ set nuget_params=-MSBuildPath !msbuild_path!
+) else (
+ set msbuild_path=
+ set nuget_params=
+)
+:skip_build_tools
+
+set nuget_dir=%this_dir%.nuget
+
+if not "%cswinrt_label%"=="" goto %cswinrt_label%
+
+: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
+rem Note: packages.config-based (vcxproj) projects do not support msbuild /t:restore
+call %this_dir%get_testwinrt.cmd
+set NUGET_RESTORE_MSBUILD_ARGS=/p:platform="%cswinrt_platform%"
+call :exec %nuget_dir%\nuget.exe restore %nuget_params% %this_dir%cswinrt.sln
+rem: Calling nuget restore again on ObjectLifetimeTests.Lifted.csproj to prevent .props from \microsoft.testplatform.testhost\build\netcoreapp2.1 from being included. Nuget.exe erroneously imports props files. https://github.com/NuGet/Home/issues/9672
+call :exec %msbuild_path%msbuild.exe %this_dir%\Tests\ObjectLifetimeTests\ObjectLifetimeTests.Lifted.csproj /t:restore /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%
+
+:build
+echo Building cswinrt for %cswinrt_platform% %cswinrt_configuration%
+call :exec %msbuild_path%msbuild.exe %cswinrt_build_params% /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%;VersionNumber=%cswinrt_version_number%;VersionString=%cswinrt_version_string%;AssemblyVersionNumber=%cswinrt_assembly_version%;GenerateTestProjection=true;BaselineAllAPICompatError=%cswinrt_baseline_breaking_compat_errors%;BaselineAllMatchingRefApiCompatError=%cswinrt_baseline_assembly_version_compat_errors% %this_dir%cswinrt.sln
+if ErrorLevel 1 (
+ echo.
+ echo ERROR: Build failed
+ exit /b !ErrorLevel!
+)
+if "%cswinrt_build_only%"=="true" goto :eof
+
+:buildembedded
+echo Building embedded sample for %cswinrt_platform% %cswinrt_configuration%
+call :exec %nuget_dir%\nuget.exe restore %nuget_params% %this_dir%Samples\TestEmbedded\TestEmbedded.sln
+call :exec %msbuild_path%msbuild.exe %this_dir%\Samples\TestEmbedded\TestEmbedded.sln /t:restore /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%
+call :exec %msbuild_path%msbuild.exe %this_dir%\Samples\TestEmbedded\TestEmbedded.sln /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration% /bl:embeddedsample.binlog
+if ErrorLevel 1 (
+ echo.
+ echo ERROR: Embedded build failed
+ exit /b !ErrorLevel!
+)
+
+rem Tests are not yet enabled for ARM builds (not supported by Project Reunion)
+if %cswinrt_platform%==arm goto :package
+if %cswinrt_platform%==arm64 goto :package
+
+:test
+rem Build/Run xUnit tests, generating xml output report for Azure Devops reporting, via XunitXml.TestLogger NuGet
+if %cswinrt_platform%==x86 (
+ set dotnet_exe="%DOTNET_ROOT(86)%\dotnet.exe"
+) else (
+ set dotnet_exe="%DOTNET_ROOT%\dotnet.exe"
+)
+if not exist %dotnet_exe% (
+ if %cswinrt_platform%==x86 (
+ set dotnet_exe="%ProgramFiles(x86)%\dotnet\dotnet.exe"
+ ) else (
+ set dotnet_exe="%ProgramFiles%\dotnet\dotnet.exe"
+ )
+)
+
+:embeddedtests
+:: build the embedded sample and run the unittest
+call :exec %dotnet_exe% test --verbosity normal --no-build --logger xunit;LogFilePath=%~dp0embedunittest_%cswinrt_version_string%.xml %this_dir%Samples/TestEmbedded/UnitTestEmbedded/UnitTestEmbedded.csproj /nologo /m /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%
+if ErrorLevel 1 (
+ echo.
+ echo ERROR: Embedded unit test failed, skipping NuGet pack
+ exit /b !ErrorLevel!
+)
+
+:objectlifetimetests
+rem Running Object Lifetime Unit Tests
+echo Running object lifetime tests for %cswinrt_platform% %cswinrt_configuration%
+if '%NUGET_PACKAGES%'=='' set NUGET_PACKAGES=%USERPROFILE%\.nuget\packages
+call :exec vstest.console.exe %this_dir%\Tests\ObjectLifetimeTests\bin\%cswinrt_platform%\%cswinrt_configuration%\net5.0-windows10.0.19041.0\win10-%cswinrt_platform%\ObjectLifetimeTests.Lifted.build.appxrecipe /TestAdapterPath:"%NUGET_PACKAGES%\mstest.testadapter\2.2.4-preview-20210513-02\build\_common" /framework:FrameworkUap10 /logger:trx;LogFileName=%this_dir%\VsTestResults.trx
+if ErrorLevel 1 (
+ echo.
+ echo ERROR: Lifetime test failed, skipping NuGet pack
+ exit /b !ErrorLevel!
+)
+
+:unittest
+rem WinUI NuGet package's Microsoft.WinUI.AppX.targets attempts to import a file that does not exist, even when
+rem executing "dotnet test --no-build ...", which evidently still needs to parse and load the entire project.
+rem Work around by using a dummy targets file and assigning it to the MsAppxPackageTargets property.
+echo Running cswinrt unit tests for %cswinrt_platform% %cswinrt_configuration%
+echo ^ > %temp%\EmptyMsAppxPackage.Targets
+call :exec %dotnet_exe% test --verbosity normal --no-build --logger xunit;LogFilePath=%~dp0unittest_%cswinrt_version_string%.xml %this_dir%Tests/unittest/UnitTest.csproj /nologo /m /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%;MsAppxPackageTargets=%temp%\EmptyMsAppxPackage.Targets
+if ErrorLevel 1 (
+ echo.
+ echo ERROR: Unit test failed, skipping NuGet pack
+ exit /b !ErrorLevel!
+)
+
+:hosttest
+rem Run WinRT.Host tests
+echo Running cswinrt host tests for %cswinrt_platform% %cswinrt_configuration%
+call :exec %this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\HostTest\bin\HostTest.exe --gtest_output=xml:%this_dir%hosttest_%cswinrt_version_string%.xml
+if ErrorLevel 1 (
+ echo.
+ echo ERROR: Host test failed, skipping NuGet pack
+ exit /b !ErrorLevel!
+)
+
+:authortest
+rem Run Authoring tests
+echo Running cswinrt authoring tests for %cswinrt_platform% %cswinrt_configuration%
+call :exec %this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\AuthoringConsumptionTest\bin\AuthoringConsumptionTest.exe --gtest_output=xml:%this_dir%hosttest_%cswinrt_version_string%.xml
+if ErrorLevel 1 (
+ echo.
+ echo ERROR: Authoring test failed, skipping NuGet pack
+ exit /b !ErrorLevel!
+)
+
+:package
+rem We set the properties of the CsWinRT.nuspec here, and pass them as the -Properties option when we call `nuget pack`
+set cswinrt_bin_dir=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\cswinrt\bin\
+set cswinrt_exe=%cswinrt_bin_dir%cswinrt.exe
+set interop_winmd=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\cswinrt\obj\merged\WinRT.Interop.winmd
+set netstandard2_runtime=%this_dir%WinRT.Runtime\bin\%cswinrt_configuration%\netstandard2.0\WinRT.Runtime.dll
+set net5_runtime=%this_dir%WinRT.Runtime\bin\%cswinrt_configuration%\net5.0\WinRT.Runtime.dll
+set source_generator=%this_dir%Authoring\WinRT.SourceGenerator\bin\%cswinrt_configuration%\netstandard2.0\WinRT.SourceGenerator.dll
+set winrt_host_%cswinrt_platform%=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\WinRT.Host\bin\WinRT.Host.dll
+set winrt_host_resource_%cswinrt_platform%=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\WinRT.Host\bin\WinRT.Host.dll.mui
+set winrt_shim=%this_dir%Authoring\WinRT.Host.Shim\bin\%cswinrt_configuration%\net5.0\WinRT.Host.Shim.dll
+set guid_patch=%this_dir%Perf\IIDOptimizer\bin\%cswinrt_configuration%\net5.0\*.*
+rem Now call pack
+echo Creating nuget package
+call :exec %nuget_dir%\nuget pack %this_dir%..\nuget\Microsoft.Windows.CsWinRT.nuspec -Properties cswinrt_exe=%cswinrt_exe%;interop_winmd=%interop_winmd%;netstandard2_runtime=%netstandard2_runtime%;net5_runtime=%net5_runtime%;source_generator=%source_generator%;cswinrt_nuget_version=%cswinrt_version_string%;winrt_host_x86=%winrt_host_x86%;winrt_host_x64=%winrt_host_x64%;winrt_host_arm=%winrt_host_arm%;winrt_host_arm64=%winrt_host_arm64%;winrt_host_resource_x86=%winrt_host_resource_x86%;winrt_host_resource_x64=%winrt_host_resource_x64%;winrt_host_resource_arm=%winrt_host_resource_arm%;winrt_host_resource_arm64=%winrt_host_resource_arm64%;winrt_shim=%winrt_shim%;guid_patch=%guid_patch% -OutputDirectory %cswinrt_bin_dir% -NonInteractive -Verbosity Detailed -NoPackageAnalysis
+goto :eof
+
+:exec
+if /i "%cswinrt_echo%" == "only" (
+echo Command Line:
+echo %*
+echo.
+) else (
+%*
+)
+goto :eof
+
From cb23e3ebf0cb599628ee3cc2a5a7984e7be5f060 Mon Sep 17 00:00:00 2001
From: Joshua Larkin <70237359+j0shuams@users.noreply.github.com>
Date: Mon, 11 Apr 2022 15:34:39 -0700
Subject: [PATCH 4/6] refactor copying sources for any platform
---
...Microsoft.Windows.CsWinRT.Embedded.targets | 7 ++-
.../TestEmbedded/Directory.Build.targets | 62 +++----------------
2 files changed, 14 insertions(+), 55 deletions(-)
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/src/Samples/TestEmbedded/Directory.Build.targets b/src/Samples/TestEmbedded/Directory.Build.targets
index 0acdcad35..ef00fcf92 100644
--- a/src/Samples/TestEmbedded/Directory.Build.targets
+++ b/src/Samples/TestEmbedded/Directory.Build.targets
@@ -20,63 +20,21 @@
AfterTargets="CsWinRTGenerateProjection"
BeforeTargets="CsWinRTIncludeProjection">
-
-
-
-
-
- $(WinRTRuntimeSourcesDir)TypeNameSupport.cs;
- $(WinRTRuntimeSourcesDir)TypeExtensions.cs;
- $(WinRTRuntimeSourcesDir)Projections.cs;
- $(WinRTRuntimeSourcesDir)ObjectReference.cs;
- $(WinRTRuntimeSourcesDir)MonoSupport.cs;
- $(WinRTRuntimeSourcesDir)Module.cs;
- $(WinRTRuntimeSourcesDir)Marshalers.cs;
- $(WinRTRuntimeSourcesDir)IInspectable.cs;
- $(WinRTRuntimeSourcesDir)GuidGenerator.cs;
- $(WinRTRuntimeSourcesDir)FundamentalMarshalers.cs;
- $(WinRTRuntimeSourcesDir)ExceptionHelpers.cs;
- $(WinRTRuntimeSourcesDir)EventRegistrationToken.cs;
- $(WinRTRuntimeSourcesDir)DerivedComposed.cs;
- $(WinRTRuntimeSourcesDir)Context.cs;
- $(WinRTRuntimeSourcesDir)ComWrappersSupport.cs;
- $(WinRTRuntimeSourcesDir)CastExtensions.cs;
- $(WinRTRuntimeSourcesDir)Attributes.cs;
- $(WinRTRuntimeSourcesDir)AgileReference.cs;
- $(WinRTRuntimeSourcesDir)WinRTRuntimeErrorStrings.Designer.cs;
- $(WinRTRuntimeSourcesDir)Projections\EventHandler.cs;
- $(WinRTRuntimeSourcesDir)Projections\Geometry.cs;
- $(WinRTRuntimeSourcesDir)Projections\IStringable.cs;
- $(WinRTRuntimeSourcesDir)Projections\KeyValuePair.cs;
- $(WinRTRuntimeSourcesDir)Projections\NotifyCollectionChangedAction.cs;
- $(WinRTRuntimeSourcesDir)Projections\NotifyCollectionChangedEventArgs.cs;
- $(WinRTRuntimeSourcesDir)Projections\NotifyCollectionChangedEventHandler.cs;
- $(WinRTRuntimeSourcesDir)Projections\Nullable.cs;
- $(WinRTRuntimeSourcesDir)Projections\Numerics.cs;
- $(WinRTRuntimeSourcesDir)Projections\PropertyChangedEventArgs.cs;
- $(WinRTRuntimeSourcesDir)Projections\PropertyChangedEventHandler.cs;
- $(WinRTRuntimeSourcesDir)Projections\SystemTypes.cs;
- $(WinRTRuntimeSourcesDir)Projections\Type.cs;
- $(WinRTRuntimeSourcesDir)Projections\Uri.cs;
- $(WinRTRuntimeSourcesDir)Projections\DataErrorsChangedEventArgs.cs;
- $(WinRTRuntimeSourcesDir)Interop\IReferenceTracker.cs;
- $(WinRTRuntimeSourcesDir)Interop\IUnknownVftbl.cs;
- $(WinRTRuntimeSourcesDir)Interop\StandardDelegates.cs;
- $(WinRTRuntimeSourcesDir)Interop\ExceptionErrorInfo.cs;
- $(WinRTRuntimeSourcesDir)Interop\IActivationFactory.cs;
- $(WinRTRuntimeSourcesDir)Interop\IContextCallback.cs;
- $(WinRTRuntimeSourcesDir)Interop\IMarshal.cs;
-
-
-
+
+ <_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" />
+
-
+
-
-
Date: Mon, 11 Apr 2022 15:41:39 -0700
Subject: [PATCH 5/6] add embedded build task to build steps
---
.../CsWinRT-Build-Steps.yml | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
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
From e4781ec919305d55493d6c6d619acb447f0c4e6c Mon Sep 17 00:00:00 2001
From: Joshua Larkin <70237359+j0shuams@users.noreply.github.com>
Date: Mon, 11 Apr 2022 22:22:41 -0700
Subject: [PATCH 6/6] indent
---
src/Samples/TestEmbedded/NetFrameworkApp/Program.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Samples/TestEmbedded/NetFrameworkApp/Program.cs b/src/Samples/TestEmbedded/NetFrameworkApp/Program.cs
index 55430a277..16626e0e7 100644
--- a/src/Samples/TestEmbedded/NetFrameworkApp/Program.cs
+++ b/src/Samples/TestEmbedded/NetFrameworkApp/Program.cs
@@ -45,7 +45,7 @@ class MyGreek : IAlpha, IGamma
public class TestLib
{
- public TestLib()
+ public TestLib()
{
}