From b216a3854af21aa003cd3ddc19bc4b982e843b40 Mon Sep 17 00:00:00 2001 From: angelazhangmsft Date: Tue, 23 Nov 2021 10:20:20 -0800 Subject: [PATCH] Update the projection sample to .NET 6 (#1054) --- docs/usage.md | 6 +-- .../ConsoleAppSample/Program.cs | 14 ------- src/Samples/Net5ProjectionSample/README.md | 32 -------------- .../SimpleMathComponent/PropertySheet.props | 15 ------- .../SimpleMathComponent/SimpleMath.idl | 22 ---------- .../nuget/SimpleMathProjection.nuspec | 25 ----------- .../ConsoleAppSample.sln | 0 .../ConsoleAppSample/ConsoleAppSample.csproj | 4 +- .../ConsoleAppSample/Program.cs | 5 +++ .../CppWinRTComponentProjectionSample.sln | 30 ++++++++----- .../Directory.Build.props | 0 .../Directory.Build.targets | 0 src/Samples/NetProjectionSample/README.md | 42 +++++++++++++++++++ .../SimpleMathComponent/SimpleMath.cpp | 13 ++---- .../SimpleMathComponent/SimpleMath.h | 13 ++---- .../SimpleMathComponent/SimpleMath.idl | 15 +++++++ .../SimpleMathComponent.def | 0 .../SimpleMathComponent.vcxproj | 36 ++++------------ .../SimpleMathComponent.vcxproj.filters | 3 -- .../SimpleMathComponent/packages.config | 2 +- .../SimpleMathComponent/pch.cpp | 0 .../SimpleMathComponent/pch.h | 0 .../SimpleMathProjection.csproj | 13 ++++-- .../nuget/SimpleMathProjection.nuspec | 20 +++++++++ 24 files changed, 131 insertions(+), 179 deletions(-) delete mode 100644 src/Samples/Net5ProjectionSample/ConsoleAppSample/Program.cs delete mode 100644 src/Samples/Net5ProjectionSample/README.md delete mode 100644 src/Samples/Net5ProjectionSample/SimpleMathComponent/PropertySheet.props delete mode 100644 src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMath.idl delete mode 100644 src/Samples/Net5ProjectionSample/SimpleMathProjection/nuget/SimpleMathProjection.nuspec rename src/Samples/{Net5ProjectionSample => NetProjectionSample}/ConsoleAppSample.sln (100%) rename src/Samples/{Net5ProjectionSample => NetProjectionSample}/ConsoleAppSample/ConsoleAppSample.csproj (81%) create mode 100644 src/Samples/NetProjectionSample/ConsoleAppSample/Program.cs rename src/Samples/{Net5ProjectionSample => NetProjectionSample}/CppWinRTComponentProjectionSample.sln (75%) rename src/Samples/{Net5ProjectionSample => NetProjectionSample}/Directory.Build.props (100%) rename src/Samples/{Net5ProjectionSample => NetProjectionSample}/Directory.Build.targets (100%) create mode 100644 src/Samples/NetProjectionSample/README.md rename src/Samples/{Net5ProjectionSample => NetProjectionSample}/SimpleMathComponent/SimpleMath.cpp (58%) rename src/Samples/{Net5ProjectionSample => NetProjectionSample}/SimpleMathComponent/SimpleMath.h (57%) create mode 100644 src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMath.idl rename src/Samples/{Net5ProjectionSample => NetProjectionSample}/SimpleMathComponent/SimpleMathComponent.def (100%) rename src/Samples/{Net5ProjectionSample => NetProjectionSample}/SimpleMathComponent/SimpleMathComponent.vcxproj (82%) rename src/Samples/{Net5ProjectionSample => NetProjectionSample}/SimpleMathComponent/SimpleMathComponent.vcxproj.filters (92%) rename src/Samples/{Net5ProjectionSample => NetProjectionSample}/SimpleMathComponent/packages.config (59%) rename src/Samples/{Net5ProjectionSample => NetProjectionSample}/SimpleMathComponent/pch.cpp (100%) rename src/Samples/{Net5ProjectionSample => NetProjectionSample}/SimpleMathComponent/pch.h (100%) rename src/Samples/{Net5ProjectionSample => NetProjectionSample}/SimpleMathProjection/SimpleMathProjection.csproj (61%) create mode 100644 src/Samples/NetProjectionSample/SimpleMathProjection/nuget/SimpleMathProjection.nuspec diff --git a/docs/usage.md b/docs/usage.md index 4871ee03d..0ab92a8a4 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -11,7 +11,7 @@ For more information on using the NuGet package, refer to the [NuGet documentati Component authors need to build a C#/WinRT interop assembly for .NET 5+ consumers. The C#/WinRT NuGet package (Microsoft.Windows.CsWinRT) includes the C#/WinRT compiler, **cswinrt.exe**, which you can use to process .winmd files and generate projection source files. These source files are compiled into an interop projection assembly, and then distributed along with the C#/WinRT runtime assembly for .NET 5+ applications to reference. -For an example of generating and distributing a projection interop assembly as a NuGet package, see the [projection sample](https://github.com/microsoft/CsWinRT/tree/master/src/Samples/Net5ProjectionSample) and [associated walkthrough](https://docs.microsoft.com/windows/uwp/csharp-winrt/net-projection-from-cppwinrt-component). +For an example of generating and distributing a projection interop assembly as a NuGet package, see the [projection sample](https://github.com/microsoft/CsWinRT/tree/master/src/Samples/NetProjectionSample) and [associated walkthrough](https://docs.microsoft.com/windows/uwp/csharp-winrt/net-projection-from-cppwinrt-component). ### Generating an interop assembly @@ -37,7 +37,7 @@ In the example diagram below, the projection project invokes **cswinrt.exe** at An interop assembly is typically distributed along with the implementation assemblies as a NuGet package for applications to reference. This package will require a dependency on C#/WinRT to include `WinRT.Runtime.dll` for .NET 5+ targets. If the interop assembly is not distributed as a NuGet package, an application adds references to both the component interop assembly produced above and to C#/WinRT to include the `WinRT.Runtime.dll` assembly. If a third party WinRT component is distributed without an official interop assembly, an application may add a reference to C#/WinRT to generate its own private component interop assembly. There are versioning concerns related to this scenario, so the preferred solution is for the third party to publish an interop assembly directly. -See the [projection sample](https://github.com/microsoft/CsWinRT/tree/master/src/Samples/Net5ProjectionSample) for an example of how to create and reference the interop NuGet package. +See the [projection sample](https://github.com/microsoft/CsWinRT/tree/master/src/Samples/NetProjectionSample) for an example of how to create and reference the interop NuGet package. ### Applications @@ -50,4 +50,4 @@ Application developers on .NET 5+ can reference C#/WinRT interop assemblies by a ## Author and consume a C#/WinRT component -C#/WinRT provides authoring and hosting support for .NET 5 component authors. For more details, refer to this [walkthrough](https://docs.microsoft.com/en-us/windows/uwp/csharp-winrt/create-windows-runtime-component-cswinrt) and these [authoring docs](https://github.com/microsoft/CsWinRT/blob/master/docs/authoring.md). \ No newline at end of file +C#/WinRT provides authoring and hosting support for .NET 5 component authors. For more details, refer to this [walkthrough](https://docs.microsoft.com/en-us/windows/uwp/csharp-winrt/create-windows-runtime-component-cswinrt) and these [authoring docs](https://github.com/microsoft/CsWinRT/blob/master/docs/authoring.md). diff --git a/src/Samples/Net5ProjectionSample/ConsoleAppSample/Program.cs b/src/Samples/Net5ProjectionSample/ConsoleAppSample/Program.cs deleted file mode 100644 index 7c23705cd..000000000 --- a/src/Samples/Net5ProjectionSample/ConsoleAppSample/Program.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace ConsoleAppSample -{ - class Program - { - static void Main(string[] args) - { - var x = new SimpleMathComponent.SimpleMath(); - Console.WriteLine("Adding 5.5 + 6.5 ..."); - Console.WriteLine(x.add(5.5, 6.5).ToString()); - } - } -} diff --git a/src/Samples/Net5ProjectionSample/README.md b/src/Samples/Net5ProjectionSample/README.md deleted file mode 100644 index be8814aed..000000000 --- a/src/Samples/Net5ProjectionSample/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# C#/WinRT Projection Sample - -This sample demonstrates how to do the following: - -- Use the C#/WinRT package to generate a C# projection interop assembly from a C++/WinRT component -- Distribute the component along with the interop assembly as a NuGet package -- Consume the component from a .NET 5+ console application - -## Requirements - -- Visual Studio 16.8 -- .NET 5.0 SDK -- nuget.exe 5.8.0-preview.2 (for command line MSBuild) - -## Build and run the sample - -For building in Visual Studio 2019: - -1. Build the *CppWinRTComponentProjectionSample* solution first. This builds the WinMD for SimpleMathComponent, generates a projection interop assembly for the component using C#/WinRT, and generates the SimpleMathComponent NuGet package for the component which .NET 5+ apps can reference. - -2. Build and run the *ConsoleAppSample* solution which references and restores the SimpleMathComponent NuGet package to consume the projection. - - If you run into errors restoring NuGet packages, look at the docs on [NuGet restore options](https://docs.microsoft.com/nuget/consume-packages/package-restore). You may need to configure your NuGet package manager settings to allow for package restores on build. - -For building with the command line, execute the following: - -```cmd -nuget restore CppWinRTComponentProjectionSample.sln -msbuild /p:platform=x64;configuration=debug CppWinRTComponentProjectionSample.sln -nuget restore ConsoleAppSample.sln -msbuild /p:platform=x64;configuration=debug ConsoleAppSample.sln -``` diff --git a/src/Samples/Net5ProjectionSample/SimpleMathComponent/PropertySheet.props b/src/Samples/Net5ProjectionSample/SimpleMathComponent/PropertySheet.props deleted file mode 100644 index 468498459..000000000 --- a/src/Samples/Net5ProjectionSample/SimpleMathComponent/PropertySheet.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMath.idl b/src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMath.idl deleted file mode 100644 index ed80938bc..000000000 --- a/src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMath.idl +++ /dev/null @@ -1,22 +0,0 @@ -//********************************************************* -// -// Copyright (c) Microsoft. All rights reserved. -// This code is licensed under the MIT License (MIT). -// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY -// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR -// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. -// -//********************************************************* -namespace SimpleMathComponent -{ - [default_interface] - runtimeclass SimpleMath - { - SimpleMath(); - Double add(Double firstNumber, Double secondNumber); - Double subtract(Double firstNumber, Double secondNumber); - Double multiply(Double firstNumber, Double secondNumber); - Double divide(Double firstNumber, Double secondNumber); - } -} diff --git a/src/Samples/Net5ProjectionSample/SimpleMathProjection/nuget/SimpleMathProjection.nuspec b/src/Samples/Net5ProjectionSample/SimpleMathProjection/nuget/SimpleMathProjection.nuspec deleted file mode 100644 index e95f6a5c5..000000000 --- a/src/Samples/Net5ProjectionSample/SimpleMathProjection/nuget/SimpleMathProjection.nuspec +++ /dev/null @@ -1,25 +0,0 @@ - - - - SimpleMathComponent - 0.1.0-prerelease - Contoso Math Inc. - A simple component with basic math operations - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Samples/Net5ProjectionSample/ConsoleAppSample.sln b/src/Samples/NetProjectionSample/ConsoleAppSample.sln similarity index 100% rename from src/Samples/Net5ProjectionSample/ConsoleAppSample.sln rename to src/Samples/NetProjectionSample/ConsoleAppSample.sln diff --git a/src/Samples/Net5ProjectionSample/ConsoleAppSample/ConsoleAppSample.csproj b/src/Samples/NetProjectionSample/ConsoleAppSample/ConsoleAppSample.csproj similarity index 81% rename from src/Samples/Net5ProjectionSample/ConsoleAppSample/ConsoleAppSample.csproj rename to src/Samples/NetProjectionSample/ConsoleAppSample/ConsoleAppSample.csproj index b45996f9b..177be4fec 100644 --- a/src/Samples/Net5ProjectionSample/ConsoleAppSample/ConsoleAppSample.csproj +++ b/src/Samples/NetProjectionSample/ConsoleAppSample/ConsoleAppSample.csproj @@ -2,9 +2,9 @@ Exe - net5.0-windows10.0.19041.0 + net6.0-windows10.0.19041.0 10.0.17763.0 - x64 + x64;x86;ARM64 diff --git a/src/Samples/NetProjectionSample/ConsoleAppSample/Program.cs b/src/Samples/NetProjectionSample/ConsoleAppSample/Program.cs new file mode 100644 index 000000000..a8cc0263e --- /dev/null +++ b/src/Samples/NetProjectionSample/ConsoleAppSample/Program.cs @@ -0,0 +1,5 @@ +using System; + +var x = new SimpleMathComponent.SimpleMath(); +Console.WriteLine("Adding 5.5 + 6.5 ..."); +Console.WriteLine(x.add(5.5, 6.5).ToString()); diff --git a/src/Samples/Net5ProjectionSample/CppWinRTComponentProjectionSample.sln b/src/Samples/NetProjectionSample/CppWinRTComponentProjectionSample.sln similarity index 75% rename from src/Samples/Net5ProjectionSample/CppWinRTComponentProjectionSample.sln rename to src/Samples/NetProjectionSample/CppWinRTComponentProjectionSample.sln index 2c38c2521..5391e9888 100644 --- a/src/Samples/Net5ProjectionSample/CppWinRTComponentProjectionSample.sln +++ b/src/Samples/NetProjectionSample/CppWinRTComponentProjectionSample.sln @@ -1,12 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30404.54 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.31911.260 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleMathComponent", "SimpleMathComponent\SimpleMathComponent.vcxproj", "{D6B0C16D-858A-4C1B-99CF-D6F4CF5BCD5F}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleMathProjection", "SimpleMathProjection\SimpleMathProjection.csproj", "{3D562B38-115F-481C-ADE2-5A60EFBA1ED0}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleMathComponent", "SimpleMathComponent\SimpleMathComponent.vcxproj", "{D6B0C16D-858A-4C1B-99CF-D6F4CF5BCD5F}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{47FC5375-776F-4922-81DE-74E1A345F35F}" ProjectSection(SolutionItems) = preProject Directory.Build.props = Directory.Build.props @@ -15,26 +15,36 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Debug|ARM64.Build.0 = Debug|ARM64 + {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Debug|x64.ActiveCfg = Debug|x64 + {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Debug|x64.Build.0 = Debug|x64 + {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Debug|x86.ActiveCfg = Debug|x64 + {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Release|ARM64.ActiveCfg = Release|ARM64 + {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Release|ARM64.Build.0 = Release|ARM64 + {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Release|x64.ActiveCfg = Release|x64 + {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Release|x64.Build.0 = Release|x64 + {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Release|x86.ActiveCfg = Release|x64 + {D6B0C16D-858A-4C1B-99CF-D6F4CF5BCD5F}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {D6B0C16D-858A-4C1B-99CF-D6F4CF5BCD5F}.Debug|ARM64.Build.0 = Debug|ARM64 {D6B0C16D-858A-4C1B-99CF-D6F4CF5BCD5F}.Debug|x64.ActiveCfg = Debug|x64 {D6B0C16D-858A-4C1B-99CF-D6F4CF5BCD5F}.Debug|x64.Build.0 = Debug|x64 {D6B0C16D-858A-4C1B-99CF-D6F4CF5BCD5F}.Debug|x86.ActiveCfg = Debug|Win32 {D6B0C16D-858A-4C1B-99CF-D6F4CF5BCD5F}.Debug|x86.Build.0 = Debug|Win32 + {D6B0C16D-858A-4C1B-99CF-D6F4CF5BCD5F}.Release|ARM64.ActiveCfg = Release|ARM64 + {D6B0C16D-858A-4C1B-99CF-D6F4CF5BCD5F}.Release|ARM64.Build.0 = Release|ARM64 {D6B0C16D-858A-4C1B-99CF-D6F4CF5BCD5F}.Release|x64.ActiveCfg = Release|x64 {D6B0C16D-858A-4C1B-99CF-D6F4CF5BCD5F}.Release|x64.Build.0 = Release|x64 {D6B0C16D-858A-4C1B-99CF-D6F4CF5BCD5F}.Release|x86.ActiveCfg = Release|Win32 {D6B0C16D-858A-4C1B-99CF-D6F4CF5BCD5F}.Release|x86.Build.0 = Release|Win32 - {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Debug|x64.ActiveCfg = Debug|x64 - {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Debug|x64.Build.0 = Debug|x64 - {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Debug|x86.ActiveCfg = Debug|x64 - {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Release|x64.ActiveCfg = Release|x64 - {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Release|x64.Build.0 = Release|x64 - {3D562B38-115F-481C-ADE2-5A60EFBA1ED0}.Release|x86.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Samples/Net5ProjectionSample/Directory.Build.props b/src/Samples/NetProjectionSample/Directory.Build.props similarity index 100% rename from src/Samples/Net5ProjectionSample/Directory.Build.props rename to src/Samples/NetProjectionSample/Directory.Build.props diff --git a/src/Samples/Net5ProjectionSample/Directory.Build.targets b/src/Samples/NetProjectionSample/Directory.Build.targets similarity index 100% rename from src/Samples/Net5ProjectionSample/Directory.Build.targets rename to src/Samples/NetProjectionSample/Directory.Build.targets diff --git a/src/Samples/NetProjectionSample/README.md b/src/Samples/NetProjectionSample/README.md new file mode 100644 index 000000000..51d718595 --- /dev/null +++ b/src/Samples/NetProjectionSample/README.md @@ -0,0 +1,42 @@ +# C#/WinRT Projection Sample + +This sample demonstrates how to do the following: + +- Use the C#/WinRT package to generate a C# .NET projection interop assembly from a C++/WinRT component +- Distribute the component along with the interop assembly as a NuGet package +- Consume the component from a .NET 6 C# console application + +## Requirements + +* [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) with the Universal Windows Platform development workload installed. In **Installation Details** > **Universal Windows Platform development**, check the **C++ (v14x) Universal Windows Platform tools** option. +* [.NET 6 SDK](https://dotnet.microsoft.com/download/dotnet/6.0) +* nuget.exe 5.8.0-preview.2 or later (for command line MSBuild) + +**Note**: This sample uses .NET 6 and therefore requires Visual Studio 2022 to build and run. If you prefer, you can use Visual Studio 2019 and modify the sample to target [.NET 5](https://dotnet.microsoft.com/download/dotnet/5.0). To do this, you will need to modify the `TargetFramework` and the *nuspec* file in the `SimpleMathProjection` project to target `net5.0-windows10.0.19041.0`. + +## Build and run the sample + +For building in Visual Studio: + +1. Open *CppWinRTComponentProjectionSample.sln* in Visual Studio. Ensure that *SimpleMathProjection* is set as the startup project, and set the Platform and Configuration to x64 and Release. Right click on the solution and build. This will do the following: + - Build *SimpleMathComponent*: this will generate *SimpleMathComponent.winmd* and *SimpleMathComponent.dll* + - Generate the projection interop assembly for the component using C#/WinRT, *SimpleMathProjection.dll* + - Generate a NuGet package for the component. To ensure the solution has built successfully, navigate to the *SimpleMathProjection/nuget* folder in your file explorer. You should see the generated NuGet package (*SimpleMathComponent.0.1.0-prerelease.nupkg*). which can be referenced by C# .NET app consumers. + +2. Open *ConsoleAppSample.sln* in Visual Studio. Build and run the solution which references and restores the SimpleMathComponent NuGet package to consume the projection. + + - If you run into errors restoring NuGet packages, look at the docs on [NuGet restore options](https://docs.microsoft.com/nuget/consume-packages/package-restore). You may need to configure your NuGet package manager settings to allow for package restores on build. You may also need to run `nuget.exe restore ConsoleAppSample.sln` from a command prompt. + +For building with the command line, execute the following: + +```cmd +nuget restore CppWinRTComponentProjectionSample.sln +msbuild /p:platform=x64;configuration=release CppWinRTComponentProjectionSample.sln +nuget restore ConsoleAppSample.sln +msbuild /p:platform=x64;configuration=release ConsoleAppSample.sln +``` + +## Resources + +- [Walkthrough documentation](https://docs.microsoft.com/windows/uwp/csharp-winrt/net-projection-from-cppwinrt-component) for this sample +- [C#/WinRT NuGet properties](../../../nuget/README.md) \ No newline at end of file diff --git a/src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMath.cpp b/src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMath.cpp similarity index 58% rename from src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMath.cpp rename to src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMath.cpp index fd69a7362..befc6dbab 100644 --- a/src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMath.cpp +++ b/src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMath.cpp @@ -1,13 +1,6 @@ -//********************************************************* -// -// Copyright (c) Microsoft. All rights reserved. -// This code is licensed under the MIT License (MIT). -// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY -// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR -// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. -// -//********************************************************* +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + #include "pch.h" #include "SimpleMath.h" #include "SimpleMath.g.cpp" diff --git a/src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMath.h b/src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMath.h similarity index 57% rename from src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMath.h rename to src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMath.h index 4f12c1f07..6ba39cdc4 100644 --- a/src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMath.h +++ b/src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMath.h @@ -1,13 +1,6 @@ -//********************************************************* -// -// Copyright (c) Microsoft. All rights reserved. -// This code is licensed under the MIT License (MIT). -// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY -// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR -// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. -// -//********************************************************* +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + #pragma once #include "SimpleMath.g.h" diff --git a/src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMath.idl b/src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMath.idl new file mode 100644 index 000000000..0aea674dc --- /dev/null +++ b/src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMath.idl @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +namespace SimpleMathComponent +{ + [default_interface] + runtimeclass SimpleMath + { + SimpleMath(); + Double add(Double firstNumber, Double secondNumber); + Double subtract(Double firstNumber, Double secondNumber); + Double multiply(Double firstNumber, Double secondNumber); + Double divide(Double firstNumber, Double secondNumber); + } +} diff --git a/src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMathComponent.def b/src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMathComponent.def similarity index 100% rename from src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMathComponent.def rename to src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMathComponent.def diff --git a/src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMathComponent.vcxproj b/src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMathComponent.vcxproj similarity index 82% rename from src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMathComponent.vcxproj rename to src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMathComponent.vcxproj index f5f6e9471..3ba58c27c 100644 --- a/src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMathComponent.vcxproj +++ b/src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMathComponent.vcxproj @@ -1,6 +1,6 @@ - + true true @@ -14,15 +14,11 @@ true Windows Store 10.0 - 10.0.19041.0 + 10.0 10.0.17763.0 - - Debug - ARM - Debug ARM64 @@ -35,10 +31,6 @@ Debug x64 - - Release - ARM - Release ARM64 @@ -54,7 +46,7 @@ DynamicLibrary - v142 + v143 Unicode false @@ -67,13 +59,10 @@ true false - - true - - + true - + true @@ -88,9 +77,6 @@ true - - true - @@ -99,9 +85,6 @@ - - - @@ -160,18 +143,15 @@ - - - - + 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/src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMathComponent.vcxproj.filters b/src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMathComponent.vcxproj.filters similarity index 92% rename from src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMathComponent.vcxproj.filters rename to src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMathComponent.vcxproj.filters index c1f2c3dd6..da3329bd5 100644 --- a/src/Samples/Net5ProjectionSample/SimpleMathComponent/SimpleMathComponent.vcxproj.filters +++ b/src/Samples/NetProjectionSample/SimpleMathComponent/SimpleMathComponent.vcxproj.filters @@ -20,9 +20,6 @@ - - - diff --git a/src/Samples/Net5ProjectionSample/SimpleMathComponent/packages.config b/src/Samples/NetProjectionSample/SimpleMathComponent/packages.config similarity index 59% rename from src/Samples/Net5ProjectionSample/SimpleMathComponent/packages.config rename to src/Samples/NetProjectionSample/SimpleMathComponent/packages.config index 68fd1b237..16e10b47b 100644 --- a/src/Samples/Net5ProjectionSample/SimpleMathComponent/packages.config +++ b/src/Samples/NetProjectionSample/SimpleMathComponent/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/Samples/Net5ProjectionSample/SimpleMathComponent/pch.cpp b/src/Samples/NetProjectionSample/SimpleMathComponent/pch.cpp similarity index 100% rename from src/Samples/Net5ProjectionSample/SimpleMathComponent/pch.cpp rename to src/Samples/NetProjectionSample/SimpleMathComponent/pch.cpp diff --git a/src/Samples/Net5ProjectionSample/SimpleMathComponent/pch.h b/src/Samples/NetProjectionSample/SimpleMathComponent/pch.h similarity index 100% rename from src/Samples/Net5ProjectionSample/SimpleMathComponent/pch.h rename to src/Samples/NetProjectionSample/SimpleMathComponent/pch.h diff --git a/src/Samples/Net5ProjectionSample/SimpleMathProjection/SimpleMathProjection.csproj b/src/Samples/NetProjectionSample/SimpleMathProjection/SimpleMathProjection.csproj similarity index 61% rename from src/Samples/Net5ProjectionSample/SimpleMathProjection/SimpleMathProjection.csproj rename to src/Samples/NetProjectionSample/SimpleMathProjection/SimpleMathProjection.csproj index e92488e03..9e2db95d3 100644 --- a/src/Samples/Net5ProjectionSample/SimpleMathProjection/SimpleMathProjection.csproj +++ b/src/Samples/NetProjectionSample/SimpleMathProjection/SimpleMathProjection.csproj @@ -1,19 +1,22 @@  - net5.0-windows10.0.19041.0 + + net6.0-windows10.0.19041.0 10.0.17763.0 - x64 + x64;x86;ARM64 - + - + + SimpleMathComponent + $(OutDir) @@ -21,7 +24,9 @@ .\nuget\ $(GeneratedNugetDir)SimpleMathProjection.nuspec + $(GeneratedNugetDir) + true diff --git a/src/Samples/NetProjectionSample/SimpleMathProjection/nuget/SimpleMathProjection.nuspec b/src/Samples/NetProjectionSample/SimpleMathProjection/nuget/SimpleMathProjection.nuspec new file mode 100644 index 000000000..3e74ae3ee --- /dev/null +++ b/src/Samples/NetProjectionSample/SimpleMathProjection/nuget/SimpleMathProjection.nuspec @@ -0,0 +1,20 @@ + + + + SimpleMathComponent + 0.1.0-prerelease + Contoso Math Inc. + A simple component with basic math operations + + + + + + + + + + + + + \ No newline at end of file