diff --git a/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.Interop.csproj b/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.Interop.csproj index 0eae08f67e..2918ee1923 100644 --- a/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.Interop.csproj +++ b/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.Interop.csproj @@ -12,10 +12,11 @@ $(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration) $(BuildOutputDir)\Microsoft.AI.MachineLearning.Interop $(WindowsAIInteropOutputDir) + 7.3 - + @@ -25,7 +26,7 @@ - + @@ -36,8 +37,8 @@ $(CsWinRTPath)cswinrt.exe -verbose -in local -in @(WindowsAIsWinMDs->'"%(FullPath)"', ' ') -out "$(ProjectDir)Generated Files" -include Microsoft.AI.MachineLearning - - + + diff --git a/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.targets b/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.targets index 0c38e34e04..85bc61489d 100644 --- a/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.targets +++ b/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.targets @@ -3,6 +3,8 @@ x64 x86 + x64 + x86 $(PlatformTarget) diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/main.cs b/csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/main.cs deleted file mode 100644 index 1c86164698..0000000000 --- a/csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/main.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.IO; - -using Microsoft.AI.MachineLearning; -using WinRT; - -namespace Microsoft.AI.MachineLearning.Tests -{ - class Program - { - static void Main(string[] args) - { - Console.WriteLine("Load squeezenet.onnx."); - using (var model = LearningModel.LoadFromFilePath("squeezenet.onnx")) - { - Console.WriteLine("Load kitten_224.png as StorageFile."); - var name = AppDomain.CurrentDomain.BaseDirectory + "kitten_224.png"; - var image_task = Windows.Storage.StorageFile.GetFileFromPathAsync(name); - image_task.AsTask().Wait(); - var image = image_task.GetResults(); - Console.WriteLine("Load StorageFile into Stream."); - var stream_task = image.OpenReadAsync(); - System.Threading.Thread.Sleep(1000); - // stream_task.AsTask().Wait(); - // - // Unable to call AsTask on IAsyncOperation... - // System.TypeInitializationException: 'The type initializer for 'ABI.Windows.Foundation.AsyncOperationCompletedHandler`1' threw an exception.' - // This exception was originally thrown at this call stack: - // System.RuntimeType.ThrowIfTypeNeverValidGenericArgument(System.RuntimeType) - // System.RuntimeType.SanityCheckGenericArguments(System.RuntimeType[], System.RuntimeType[]) - // System.RuntimeType.MakeGenericType(System.Type[]) - // System.Linq.Expressions.Compiler.DelegateHelpers.MakeNewDelegate(System.Type[]) - // System.Linq.Expressions.Compiler.DelegateHelpers.MakeDelegateType(System.Type[]) - // ABI.Windows.Foundation.AsyncOperationCompletedHandler.AsyncOperationCompletedHandler() - // - // So sleep instead... - using (var stream = stream_task.GetResults()) - { - Console.WriteLine("Create SoftwareBitmap from decoded Stream."); - var decoder_task = Windows.Graphics.Imaging.BitmapDecoder.CreateAsync(stream); - System.Threading.Thread.Sleep(1000); - // decoder_task.AsTask().Wait(); - // - // Unable to call AsTask on IAsyncOperation... - // System.TypeInitializationException: 'The type initializer for 'ABI.Windows.Foundation.AsyncOperationCompletedHandler`1' threw an exception.' - // This exception was originally thrown at this call stack: - // System.RuntimeType.ThrowIfTypeNeverValidGenericArgument(System.RuntimeType) - // System.RuntimeType.SanityCheckGenericArguments(System.RuntimeType[], System.RuntimeType[]) - // System.RuntimeType.MakeGenericType(System.Type[]) - // System.Linq.Expressions.Compiler.DelegateHelpers.MakeNewDelegate(System.Type[]) - // System.Linq.Expressions.Compiler.DelegateHelpers.MakeDelegateType(System.Type[]) - // ABI.Windows.Foundation.AsyncOperationCompletedHandler.AsyncOperationCompletedHandler() - // - // So sleep instead... - var decoder = decoder_task.GetResults(); - var software_bitmap_task = decoder.GetSoftwareBitmapAsync(); - System.Threading.Thread.Sleep(1000); - // software_bitmap_task.AsTask().Wait(); - // - // Unable to call AsTask on IAsyncOperation... - // System.TypeInitializationException: 'The type initializer for 'ABI.Windows.Foundation.AsyncOperationCompletedHandler`1' threw an exception.' - // This exception was originally thrown at this call stack: - // System.RuntimeType.ThrowIfTypeNeverValidGenericArgument(System.RuntimeType) - // System.RuntimeType.SanityCheckGenericArguments(System.RuntimeType[], System.RuntimeType[]) - // System.RuntimeType.MakeGenericType(System.Type[]) - // System.Linq.Expressions.Compiler.DelegateHelpers.MakeNewDelegate(System.Type[]) - // System.Linq.Expressions.Compiler.DelegateHelpers.MakeDelegateType(System.Type[]) - // ABI.Windows.Foundation.AsyncOperationCompletedHandler.AsyncOperationCompletedHandler() - // - // So sleep instead... - using (var software_bitmap = software_bitmap_task.GetResults()) - { - Console.WriteLine("Create VideoFrame."); - var frame = Windows.Media.VideoFrame.CreateWithSoftwareBitmap(software_bitmap); - - Console.WriteLine("Create LearningModelSession."); - using (var session = new LearningModelSession(model)) - { - Console.WriteLine("Create LearningModelBinding."); - var binding = new LearningModelBinding(session); - Console.WriteLine("Bind data_0."); - binding.Bind("data_0", frame); - Console.WriteLine("Evaluate."); - var results = session.Evaluate(binding, ""); - } - Console.WriteLine("Success!\n"); - } - } - } - } - } -} diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/.gitignore b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/.gitignore similarity index 100% rename from csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/.gitignore rename to csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/.gitignore diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0.csproj b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0.csproj new file mode 100644 index 0000000000..7ad720a780 --- /dev/null +++ b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0.csproj @@ -0,0 +1,24 @@ + + + + Exe + netcoreapp3.0 + AnyCPU;x64 + + + + + + + + + Always + true + + + Always + true + + + + diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0.csproj.pp b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0.csproj.pp new file mode 100644 index 0000000000..8b5d03434e --- /dev/null +++ b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0.csproj.pp @@ -0,0 +1,24 @@ + + + + Exe + netcoreapp3.0 + AnyCPU;x64 + + + + + + + + + Always + true + + + Always + true + + + + diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/NuGet.config b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/NuGet.config new file mode 100644 index 0000000000..246b26a586 --- /dev/null +++ b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/NuGet.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/NuGet.config.pp b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/NuGet.config.pp new file mode 100644 index 0000000000..7597671d5b --- /dev/null +++ b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/NuGet.config.pp @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/Program.cs b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/Program.cs new file mode 100644 index 0000000000..9f76811568 --- /dev/null +++ b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetCore3_0/Program.cs @@ -0,0 +1,70 @@ +using System; + +namespace ConsoleApp17 +{ + class Program + { + static void PerformInference(Windows.Media.VideoFrame frame) + { + Console.WriteLine("Load squeezenet.onnx."); + using (var model = Microsoft.AI.MachineLearning.LearningModel.LoadFromFilePath("squeezenet.onnx")) + { + Console.WriteLine("Create LearningModelSession."); + using (var session = new Microsoft.AI.MachineLearning.LearningModelSession(model)) + { + Console.WriteLine("Create LearningModelBinding."); + var binding = new Microsoft.AI.MachineLearning.LearningModelBinding(session); + Console.WriteLine("Bind data_0."); + binding.Bind("data_0", frame); + Console.WriteLine("Evaluate."); + var results = session.Evaluate(binding, ""); + } + Console.WriteLine("Success!\n"); + } + } + static void Main(string[] args) + { + Console.WriteLine("Load kitten_224.png as StorageFile."); + var name = AppDomain.CurrentDomain.BaseDirectory + "kitten_224.png"; + var getFileFromPathTask = Windows.Storage.StorageFile.GetFileFromPathAsync(name); + getFileFromPathTask.AsTask() + .ContinueWith( + (task) => + { + var image = task.Result; + Console.WriteLine("Load StorageFile into Stream."); + var stream_task = image.OpenReadAsync(); + return stream_task.AsTask().Result; + }) + .ContinueWith( + (task) => + { + using (var stream = task.Result) + { + Console.WriteLine("Create SoftwareBitmap from decoded Stream."); + var decoder_task = Windows.Graphics.Imaging.BitmapDecoder.CreateAsync(stream); + return decoder_task.AsTask().Result; + } + }) + .ContinueWith( + (task) => + { + var decoder = task.Result; + var software_bitmap_task = decoder.GetSoftwareBitmapAsync(); + return software_bitmap_task.AsTask().Result; + }) + .ContinueWith( + (task) => + { + using (var software_bitmap = task.Result) + { + Console.WriteLine("Create VideoFrame."); + var frame = Windows.Media.VideoFrame.CreateWithSoftwareBitmap(software_bitmap); + PerformInference(frame); + } + }) + .Wait(); + + } + } +} diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/.gitignore b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/.gitignore new file mode 100644 index 0000000000..b05d286e48 --- /dev/null +++ b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/.gitignore @@ -0,0 +1,4 @@ +# build, distribute, and bins (+ python proto bindings) +Debug +x64 +packages \ No newline at end of file diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/Microsoft.AI.MachineLearning.Tests.CSharp.csproj b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.csproj similarity index 81% rename from csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/Microsoft.AI.MachineLearning.Tests.CSharp.csproj rename to csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.csproj index 990dc65f90..c3db4b372a 100644 --- a/csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/Microsoft.AI.MachineLearning.Tests.CSharp.csproj +++ b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.csproj @@ -1,14 +1,14 @@  - + Debug AnyCPU {717C645E-9C4A-4EBF-A0AF-676B265E8CDA} Exe - Microsoft.AI.MachineLearning.Tests.CSharp - Microsoft.AI.MachineLearning.Tests.CSharp + Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2 + Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2 v4.7.2 512 true @@ -59,7 +59,7 @@ - packages\Microsoft.AI.MachineLearning.1.3.1-dev-20200626-0616-f44313c3d\lib\netstandard2.0\Microsoft.AI.MachineLearning.Interop.dll + packages\Microsoft.AI.MachineLearning.1.4.0-dev-20200728-0957-6cb93ccb5\lib\netstandard2.0\Microsoft.AI.MachineLearning.Interop.dll packages\Microsoft.Windows.SDK.NET.10.0.18362.3-preview\lib\netstandard2.0\Microsoft.Windows.SDK.NET.dll @@ -73,7 +73,7 @@ - packages\Microsoft.Windows.CsWinRT.0.1.0-prerelease.200512.7\lib\netstandard2.0\winrt.runtime.dll + packages\Microsoft.Windows.CsWinRT.0.1.0-prerelease.200629.3\lib\netstandard2.0\winrt.runtime.dll @@ -102,10 +102,10 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + - - + + \ No newline at end of file diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/Microsoft.AI.MachineLearning.Tests.CSharp.csproj.pp b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.csproj.pp similarity index 89% rename from csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/Microsoft.AI.MachineLearning.Tests.CSharp.csproj.pp rename to csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.csproj.pp index b0dd62e91a..45ed3d884f 100644 --- a/csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/Microsoft.AI.MachineLearning.Tests.CSharp.csproj.pp +++ b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.csproj.pp @@ -1,14 +1,14 @@  - + Debug AnyCPU {717C645E-9C4A-4EBF-A0AF-676B265E8CDA} Exe - Microsoft.AI.MachineLearning.Tests.CSharp - Microsoft.AI.MachineLearning.Tests.CSharp + Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2 + Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2 v4.7.2 512 true @@ -73,7 +73,7 @@ - packages\Microsoft.Windows.CsWinRT.0.1.0-prerelease.200512.7\lib\netstandard2.0\winrt.runtime.dll + packages\Microsoft.Windows.CsWinRT.0.1.0-prerelease.200629.3\lib\netstandard2.0\winrt.runtime.dll @@ -102,10 +102,10 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + - + \ No newline at end of file diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.sln b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.sln new file mode 100644 index 0000000000..c95abf46b0 --- /dev/null +++ b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.1082 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2", "Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.csproj", "{717C645E-9C4A-4EBF-A0AF-676B265E8CDA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {717C645E-9C4A-4EBF-A0AF-676B265E8CDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {717C645E-9C4A-4EBF-A0AF-676B265E8CDA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {717C645E-9C4A-4EBF-A0AF-676B265E8CDA}.Debug|x64.ActiveCfg = Debug|x64 + {717C645E-9C4A-4EBF-A0AF-676B265E8CDA}.Debug|x64.Build.0 = Debug|x64 + {717C645E-9C4A-4EBF-A0AF-676B265E8CDA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {717C645E-9C4A-4EBF-A0AF-676B265E8CDA}.Release|Any CPU.Build.0 = Release|Any CPU + {717C645E-9C4A-4EBF-A0AF-676B265E8CDA}.Release|x64.ActiveCfg = Release|x64 + {717C645E-9C4A-4EBF-A0AF-676B265E8CDA}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4998D043-F471-4AEC-9959-CCE3D27A444E} + EndGlobalSection +EndGlobal diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/NuGet.config b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/NuGet.config new file mode 100644 index 0000000000..246b26a586 --- /dev/null +++ b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/NuGet.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/NuGet.config.pp b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/NuGet.config.pp new file mode 100644 index 0000000000..7597671d5b --- /dev/null +++ b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/NuGet.config.pp @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/main.cs b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/main.cs new file mode 100644 index 0000000000..3e3910ac3a --- /dev/null +++ b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/main.cs @@ -0,0 +1,77 @@ +using System; +using System.IO; + +using Microsoft.AI.MachineLearning; +using WinRT; + +namespace Microsoft.AI.MachineLearning.Tests +{ + class Program + { + static void PerformInference(Windows.Media.VideoFrame frame) + { + Console.WriteLine("Load squeezenet.onnx."); + using (var model = Microsoft.AI.MachineLearning.LearningModel.LoadFromFilePath("squeezenet.onnx")) + { + Console.WriteLine("Create LearningModelSession."); + using (var session = new Microsoft.AI.MachineLearning.LearningModelSession(model)) + { + Console.WriteLine("Create LearningModelBinding."); + var binding = new Microsoft.AI.MachineLearning.LearningModelBinding(session); + Console.WriteLine("Bind data_0."); + binding.Bind("data_0", frame); + Console.WriteLine("Evaluate."); + var results = session.Evaluate(binding, ""); + } + Console.WriteLine("Success!\n"); + } + } + static void Main(string[] args) + { + Console.WriteLine("Load kitten_224.png as StorageFile."); + var name = AppDomain.CurrentDomain.BaseDirectory + "kitten_224.png"; + var getFileFromPathTask = Windows.Storage.StorageFile.GetFileFromPathAsync(name); + getFileFromPathTask.AsTask() + .ContinueWith( + (task) => + { + var image = task.Result; + Console.WriteLine("Load StorageFile into Stream."); + var stream_task = image.OpenReadAsync(); + // https://github.com/microsoft/CsWinRT/issues/335 + return stream_task.AsTask().Result; + }) + .ContinueWith( + (task) => + { + using (var stream = task.Result) + { + Console.WriteLine("Create SoftwareBitmap from decoded Stream."); + var decoder_task = Windows.Graphics.Imaging.BitmapDecoder.CreateAsync(stream); + // https://github.com/microsoft/CsWinRT/issues/335 + return decoder_task.AsTask().Result; + } + }) + .ContinueWith( + (task) => + { + var decoder = task.Result; + var software_bitmap_task = decoder.GetSoftwareBitmapAsync(); + // https://github.com/microsoft/CsWinRT/issues/335 + return software_bitmap_task.AsTask().Result; + }) + .ContinueWith( + (task) => + { + using (var software_bitmap = task.Result) + { + Console.WriteLine("Create VideoFrame."); + var frame = Windows.Media.VideoFrame.CreateWithSoftwareBitmap(software_bitmap); + PerformInference(frame); + } + }) + .Wait(); + + } + } +} diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/packages.config b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/packages.config similarity index 59% rename from csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/packages.config rename to csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/packages.config index 45703bd08c..b715ddcb76 100644 --- a/csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/packages.config +++ b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/packages.config @@ -1,6 +1,6 @@  - - + + \ No newline at end of file diff --git a/csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/packages.config.pp b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/packages.config.pp similarity index 88% rename from csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/packages.config.pp rename to csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/packages.config.pp index cacc1fee8c..fac1ec7a90 100644 --- a/csharp/test/Microsoft.AI.MachineLearning.Tests.CSharp/packages.config.pp +++ b/csharp/test/Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2/packages.config.pp @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/windowsai.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/windowsai.yml index 1d9953b18d..ac78db376c 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/windowsai.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/windowsai.yml @@ -346,26 +346,34 @@ jobs: workingDirectory: $(Build.ArtifactStagingDirectory)\merged - task: PowerShell@2 - displayName: 'NuGet Tests: Restore Windows.AI.MachineLearning Nuget Package (C#)' + displayName: 'NuGet Tests: Build Tests (CppWinRT)' + inputs: + targetType: 'inline' + script: | + msbuild /p:Platform=x86 Microsoft.AI.MachineLearning.Tests.vcxproj + msbuild /p:Platform=x64 Microsoft.AI.MachineLearning.Tests.vcxproj + workingDirectory: $(Build.SourcesDirectory)\csharp\test\Microsoft.AI.MachineLearning.Tests + + - task: PowerShell@2 + displayName: 'NuGet Tests: Fix Nuget Package references (.NET FRAMEWORK 4.7.2)' inputs: targetType: 'inline' script: | Add-Type -AssemblyName "System.IO.Compression.FileSystem" + $src_root_dir = $Env:BUILD_SOURCESDIRECTORY; + $artifacts_staging_dir = $Env:BUILD_ARTIFACTSTAGINGDIRECTORY; + $merged_nuget_path = [System.IO.Path]::Combine($artifacts_staging_dir, 'merged') $nupkgs = (Get-ChildItem -Filter Microsoft.AI.MachineLearning*) $merged_nuget_package = $nupkgs[0] $merged_nuget_package_name = $merged_nuget_package.Name $matched_name = ($merged_nuget_package_name -match "Microsoft.AI.MachineLearning.(?.*).nupkg") $package_version = $matches['version'] - $src_root_dir = $Env:BUILD_SOURCESDIRECTORY; - $artifacts_staging_dir = $Env:BUILD_ARTIFACTSTAGINGDIRECTORY; - $merged_nuget_path = [System.IO.Path]::Combine($artifacts_staging_dir, 'merged') - $src_dir = [System.IO.Path]::Combine($src_root_dir, 'csharp', 'test', 'Microsoft.AI.MachineLearning.Tests.CSharp') + $src_dir = [System.IO.Path]::Combine($src_root_dir, 'csharp', 'test', 'Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2') + $input_csproj = [System.IO.Path]::Combine($src_dir, 'Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.csproj.pp') + $csproj = [System.IO.Path]::Combine($src_dir, 'Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.csproj') $packages_dir = [System.IO.Path]::Combine($src_dir, 'packages') - - $input_csproj = [System.IO.Path]::Combine($src_dir, 'Microsoft.AI.MachineLearning.Tests.CSharp.csproj.pp') - $csproj = [System.IO.Path]::Combine($src_dir, 'Microsoft.AI.MachineLearning.Tests.CSharp.csproj') $input_csproj_content = Get-Content -Path $input_csproj $csproj_content = $input_csproj_content -replace '\[PackageVersion\]', $package_version Set-Content -Path $csproj -Value $csproj_content @@ -379,23 +387,56 @@ jobs: nuget restore -PackagesDirectory $packages_dir -Source https://api.nuget.org/v3/index.json -Source $merged_nuget_path $csproj workingDirectory: $(Build.ArtifactStagingDirectory)\merged - - task: PowerShell@2 - displayName: 'NuGet Tests: Build Tests (CppWinRT)' - inputs: - targetType: 'inline' - script: | - msbuild /p:Platform=x86 Microsoft.AI.MachineLearning.Tests.vcxproj - msbuild /p:Platform=x64 Microsoft.AI.MachineLearning.Tests.vcxproj - workingDirectory: $(Build.SourcesDirectory)\csharp\test\Microsoft.AI.MachineLearning.Tests - - task: PowerShell@2 displayName: 'NuGet Tests: Build Tests (C#)' + inputs: + targetType: 'inline' + script: | + msbuild Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.csproj /p:Platform=AnyCpu + msbuild Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.csproj /p:Platform=x64 + workingDirectory: $(Build.SourcesDirectory)\csharp\test\Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2 + + - task: PowerShell@2 + displayName: 'NuGet Tests: Fix Nuget Package references (.NET CORE 3.0)' inputs: targetType: 'inline' script: | - msbuild Microsoft.AI.MachineLearning.Tests.CSharp.csproj /p:Platform=AnyCpu - msbuild Microsoft.AI.MachineLearning.Tests.CSharp.csproj /p:Platform=x64 - workingDirectory: $(Build.SourcesDirectory)\csharp\test\Microsoft.AI.MachineLearning.Tests.CSharp + Add-Type -AssemblyName "System.IO.Compression.FileSystem" + + $src_root_dir = $Env:BUILD_SOURCESDIRECTORY; + $artifacts_staging_dir = $Env:BUILD_ARTIFACTSTAGINGDIRECTORY; + $merged_nuget_path = [System.IO.Path]::Combine($artifacts_staging_dir, 'merged') + $nupkgs = (Get-ChildItem -Filter Microsoft.AI.MachineLearning*) + $merged_nuget_package = $nupkgs[0] + $merged_nuget_package_name = $merged_nuget_package.Name + $matched_name = ($merged_nuget_package_name -match "Microsoft.AI.MachineLearning.(?.*).nupkg") + $package_version = $matches['version'] + + $src_dir = [System.IO.Path]::Combine($src_root_dir, 'csharp', 'test', 'Microsoft.AI.MachineLearning.Tests.DotNetCore3_0') + $input_csproj = [System.IO.Path]::Combine($src_dir, 'Microsoft.AI.MachineLearning.Tests.DotNetCore3_0.csproj.pp') + $csproj = [System.IO.Path]::Combine($src_dir, 'Microsoft.AI.MachineLearning.Tests.DotNetCore3_0.csproj') + $input_csproj_content = Get-Content -Path $input_csproj + $csproj_content = $input_csproj_content -replace '\[PackageVersion\]', $package_version + Set-Content -Path $csproj -Value $csproj_content + + $input_nuget_config = [System.IO.Path]::Combine($src_dir, 'NuGet.config.pp') + $nuget_config = [System.IO.Path]::Combine($src_dir, 'NuGet.config') + $input_nuget_config_content = Get-Content -Path $input_nuget_config + $nuget_config_content = $input_nuget_config_content -replace '\[BuildPackageSource\]', $merged_nuget_path + Set-Content -Path $nuget_config -Value $nuget_config_content + workingDirectory: $(Build.ArtifactStagingDirectory)\merged + + + - task: PowerShell@2 + displayName: 'NuGet Tests: Build Tests (.NET CORE 3.0)' + inputs: + targetType: 'inline' + script: | + msbuild Microsoft.AI.MachineLearning.Tests.DotNetCore3_0.csproj /p:Platform=x64 /t:Restore + msbuild Microsoft.AI.MachineLearning.Tests.DotNetCore3_0.csproj /p:Platform=x64 + msbuild Microsoft.AI.MachineLearning.Tests.DotNetCore3_0.csproj /p:Platform=AnyCpu /t:Restore + msbuild Microsoft.AI.MachineLearning.Tests.DotNetCore3_0.csproj /p:Platform=AnyCpu + workingDirectory: $(Build.SourcesDirectory)\csharp\test\Microsoft.AI.MachineLearning.Tests.DotNetCore3_0 - task: PowerShell@2 displayName: 'NuGet Tests: Run Tests' @@ -411,13 +452,19 @@ jobs: pushd .\Microsoft.AI.MachineLearning.Tests\x64\Debug .\Microsoft.AI.MachineLearning.Tests.exe popd + + Write-Host "Run Microsoft.AI.MachineLearning CSharp Tests (DotNetCore3_0)" + pushd .\Microsoft.AI.MachineLearning.Tests.DotNetCore3_0\bin\x64\Debug\netcoreapp3.0 + .\Microsoft.AI.MachineLearning.Tests.DotNetCore3_0.exe + popd + Write-Host "Run Microsoft.AI.MachineLearning CSharp Tests (AnyCpu)" - pushd .\Microsoft.AI.MachineLearning.Tests.CSharp\bin\Debug - .\Microsoft.AI.MachineLearning.Tests.CSharp.exe + pushd .\Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2\bin\Debug + .\Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.exe popd Write-Host "Run Microsoft.AI.MachineLearning CSharp Tests (x64)" - pushd .\Microsoft.AI.MachineLearning.Tests.CSharp\bin\x64\Debug - .\Microsoft.AI.MachineLearning.Tests.CSharp.exe + pushd .\Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2\bin\x64\Debug + .\Microsoft.AI.MachineLearning.Tests.DotNetFramework4_7_2.exe popd Write-Host "Done!" workingDirectory: $(Build.SourcesDirectory)\csharp\test diff --git a/tools/nuget/generate_nuspec_for_native_nuget.py b/tools/nuget/generate_nuspec_for_native_nuget.py index 9b464add20..053e765f37 100644 --- a/tools/nuget/generate_nuspec_for_native_nuget.py +++ b/tools/nuget/generate_nuspec_for_native_nuget.py @@ -77,14 +77,17 @@ def generate_dependencies(list, package_name, version): # Support .Net Core list.append('') list.append('') + list.append('') list.append('') # Support .Net Standard list.append('') list.append('') + list.append('') list.append('') # Support .Net Framework list.append('') list.append('') + list.append('') list.append('') # UAP10.0.16299, This is the earliest release of the OS that supports .NET Standard apps list.append('')