From d33060f01ba6ec57883580c2985da2e7f9db1bb0 Mon Sep 17 00:00:00 2001 From: Carsten Igel Date: Tue, 19 Nov 2024 18:00:09 +0100 Subject: [PATCH 01/11] qa: Add C++/CLI Acceptance tests After #292 it is much better to add a test for C++/CLI based assemblies --- .github/workflows/example-test.yaml | 8 ++ examples/cppcli/CppCli.sln | 48 +++++++ examples/cppcli/CppLibrary/CppLibrary.vcxproj | 124 ++++++++++++++++++ .../CppLibrary/CppLibrary.vcxproj.filters | 27 ++++ examples/cppcli/CppLibrary/MyCppClass.cpp | 7 + examples/cppcli/CppLibrary/MyCppClass.h | 8 ++ examples/cppcli/CsLibrary/CsLibrary.csproj | 15 +++ examples/cppcli/CsLibrary/MyCsClass.cs | 19 +++ .../scripts/msbuild-acceptance-test.cmd | 87 ++++++++++++ 9 files changed, 343 insertions(+) create mode 100644 examples/cppcli/CppCli.sln create mode 100644 examples/cppcli/CppLibrary/CppLibrary.vcxproj create mode 100644 examples/cppcli/CppLibrary/CppLibrary.vcxproj.filters create mode 100644 examples/cppcli/CppLibrary/MyCppClass.cpp create mode 100644 examples/cppcli/CppLibrary/MyCppClass.h create mode 100644 examples/cppcli/CsLibrary/CsLibrary.csproj create mode 100644 examples/cppcli/CsLibrary/MyCsClass.cs create mode 100644 examples/cppcli/scripts/msbuild-acceptance-test.cmd diff --git a/.github/workflows/example-test.yaml b/.github/workflows/example-test.yaml index 2a4bfd86..4f16ebe8 100644 --- a/.github/workflows/example-test.yaml +++ b/.github/workflows/example-test.yaml @@ -12,8 +12,13 @@ jobs: test_suite: - name: OutProc path: outproc + requires_cpp: false - name: 32 Bit path: 32bit + requires_cpp: false + - name: C++/CLI + path: cppcli + requires_cpp: true steps: - uses: actions/checkout@v3 @@ -37,6 +42,9 @@ jobs: - name: Build run: dotnet build -c Release + - uses: ilammy/msvc-dev-cmd@v1 + if: ${{ matrix.test_suite.requires_cpp }} + - name: Run ${{ matrix.test_suite.Name }} Acceptance test run: .\msbuild-acceptance-test.cmd working-directory: .\examples\${{ matrix.test_suite.path }}\scripts diff --git a/examples/cppcli/CppCli.sln b/examples/cppcli/CppCli.sln new file mode 100644 index 00000000..2385b338 --- /dev/null +++ b/examples/cppcli/CppCli.sln @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35506.116 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppLibrary", "CppLibrary\CppLibrary.vcxproj", "{4E2EE544-4FD0-4790-A6D7-D6A75F84F902}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsLibrary", "CsLibrary\CsLibrary.csproj", "{87C7349D-418E-47D7-9BBC-C995D008F333}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4E2EE544-4FD0-4790-A6D7-D6A75F84F902}.Debug|Any CPU.ActiveCfg = Debug|x64 + {4E2EE544-4FD0-4790-A6D7-D6A75F84F902}.Debug|Any CPU.Build.0 = Debug|x64 + {4E2EE544-4FD0-4790-A6D7-D6A75F84F902}.Debug|x64.ActiveCfg = Debug|x64 + {4E2EE544-4FD0-4790-A6D7-D6A75F84F902}.Debug|x64.Build.0 = Debug|x64 + {4E2EE544-4FD0-4790-A6D7-D6A75F84F902}.Debug|x86.ActiveCfg = Debug|Win32 + {4E2EE544-4FD0-4790-A6D7-D6A75F84F902}.Debug|x86.Build.0 = Debug|Win32 + {4E2EE544-4FD0-4790-A6D7-D6A75F84F902}.Release|Any CPU.ActiveCfg = Release|x64 + {4E2EE544-4FD0-4790-A6D7-D6A75F84F902}.Release|Any CPU.Build.0 = Release|x64 + {4E2EE544-4FD0-4790-A6D7-D6A75F84F902}.Release|x64.ActiveCfg = Release|x64 + {4E2EE544-4FD0-4790-A6D7-D6A75F84F902}.Release|x64.Build.0 = Release|x64 + {4E2EE544-4FD0-4790-A6D7-D6A75F84F902}.Release|x86.ActiveCfg = Release|Win32 + {4E2EE544-4FD0-4790-A6D7-D6A75F84F902}.Release|x86.Build.0 = Release|Win32 + {87C7349D-418E-47D7-9BBC-C995D008F333}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {87C7349D-418E-47D7-9BBC-C995D008F333}.Debug|Any CPU.Build.0 = Debug|Any CPU + {87C7349D-418E-47D7-9BBC-C995D008F333}.Debug|x64.ActiveCfg = Debug|Any CPU + {87C7349D-418E-47D7-9BBC-C995D008F333}.Debug|x64.Build.0 = Debug|Any CPU + {87C7349D-418E-47D7-9BBC-C995D008F333}.Debug|x86.ActiveCfg = Debug|Any CPU + {87C7349D-418E-47D7-9BBC-C995D008F333}.Debug|x86.Build.0 = Debug|Any CPU + {87C7349D-418E-47D7-9BBC-C995D008F333}.Release|Any CPU.ActiveCfg = Release|Any CPU + {87C7349D-418E-47D7-9BBC-C995D008F333}.Release|Any CPU.Build.0 = Release|Any CPU + {87C7349D-418E-47D7-9BBC-C995D008F333}.Release|x64.ActiveCfg = Release|Any CPU + {87C7349D-418E-47D7-9BBC-C995D008F333}.Release|x64.Build.0 = Release|Any CPU + {87C7349D-418E-47D7-9BBC-C995D008F333}.Release|x86.ActiveCfg = Release|Any CPU + {87C7349D-418E-47D7-9BBC-C995D008F333}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/examples/cppcli/CppLibrary/CppLibrary.vcxproj b/examples/cppcli/CppLibrary/CppLibrary.vcxproj new file mode 100644 index 00000000..ad63b174 --- /dev/null +++ b/examples/cppcli/CppLibrary/CppLibrary.vcxproj @@ -0,0 +1,124 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + true + {4E2EE544-4FD0-4790-A6D7-D6A75F84F902} + NetCoreCProj + CppLibrary + 10.0 + net8.0 + net6.0 + + + + DynamicLibrary + true + v143 + NetCore + Unicode + + + DynamicLibrary + false + v143 + NetCore + Unicode + + + DynamicLibrary + true + v143 + NetCore + Unicode + + + DynamicLibrary + false + v143 + NetCore + Unicode + + + + + + + + + + + + + + + + + + + + + + + Level3 + _DEBUG;%(PreprocessorDefinitions) + + + + + + + + Level3 + WIN32;_DEBUG;%(PreprocessorDefinitions) + + + + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + + + + + + + + Level3 + NDEBUG;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/cppcli/CppLibrary/CppLibrary.vcxproj.filters b/examples/cppcli/CppLibrary/CppLibrary.vcxproj.filters new file mode 100644 index 00000000..1e46703f --- /dev/null +++ b/examples/cppcli/CppLibrary/CppLibrary.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + + + Source Files + + + \ No newline at end of file diff --git a/examples/cppcli/CppLibrary/MyCppClass.cpp b/examples/cppcli/CppLibrary/MyCppClass.cpp new file mode 100644 index 00000000..6300f70b --- /dev/null +++ b/examples/cppcli/CppLibrary/MyCppClass.cpp @@ -0,0 +1,7 @@ +#include "MyCppClass.h" +namespace CppNs { + int MyCppClass::Add(int a, int b) + { + return a + b; + } +} \ No newline at end of file diff --git a/examples/cppcli/CppLibrary/MyCppClass.h b/examples/cppcli/CppLibrary/MyCppClass.h new file mode 100644 index 00000000..4baee416 --- /dev/null +++ b/examples/cppcli/CppLibrary/MyCppClass.h @@ -0,0 +1,8 @@ +#pragma once +namespace CppNs { + public ref class MyCppClass + { + public: + int Add(int a, int b); + }; +} \ No newline at end of file diff --git a/examples/cppcli/CsLibrary/CsLibrary.csproj b/examples/cppcli/CsLibrary/CsLibrary.csproj new file mode 100644 index 00000000..848cb823 --- /dev/null +++ b/examples/cppcli/CsLibrary/CsLibrary.csproj @@ -0,0 +1,15 @@ + + + + net6.0-windows;net8.0-windows + enable + enable + True + x86 + + + + + + + diff --git a/examples/cppcli/CsLibrary/MyCsClass.cs b/examples/cppcli/CsLibrary/MyCsClass.cs new file mode 100644 index 00000000..ea956005 --- /dev/null +++ b/examples/cppcli/CsLibrary/MyCsClass.cs @@ -0,0 +1,19 @@ +using System.Runtime.InteropServices; + +namespace CsNs +{ + [ComVisible(true)] + [Guid("4468308A-1E42-4CE2-8BC0-4F6AFA1951E0")] + [InterfaceType(ComInterfaceType.InterfaceIsDual)] + public interface IComClass + { + int Add(int a, int b); + }; + + [ComVisible(true)] + [ClassInterface(ClassInterfaceType.None)] + [Guid("6610DBEC-DD26-416B-BF94-A5D0C7192F6C")] + public class MyCsClass : CppNs.MyCppClass, IComClass + { + } +} diff --git a/examples/cppcli/scripts/msbuild-acceptance-test.cmd b/examples/cppcli/scripts/msbuild-acceptance-test.cmd new file mode 100644 index 00000000..e1c55b3a --- /dev/null +++ b/examples/cppcli/scripts/msbuild-acceptance-test.cmd @@ -0,0 +1,87 @@ +@ECHO off + +REM Run this script from VsDevCmd + +SET root=%~dp0\..\..\..\ + +PUSHD %root% +dotnet build-server shutdown + +dotnet pack src\dscom.build\dscom.build.csproj -p:Configuration=Release + +IF NOT EXIST %root%\_packages MKDIR _packages + +XCOPY /Y /I /C /F .\src\dscom\bin\Release\*.nupkg _packages\ +XCOPY /Y /I /C /F .\src\dscom.build\bin\Release\*.nupkg _packages\ + +dotnet build-server shutdown + +dotnet nuget locals global-packages --clear + +POPD + +PUSHD %~dp0\..\CsLibrary + +msbuild -nodeReuse:False -t:Clean -p:Configuration=Release -p:PerformAcceptanceTest=Runtime -p:SkipResolvePackageAssets=true + +dotnet build-server shutdown + +dotnet add CsLibrary.csproj package --no-restore --prerelease -s %root%\_packages dSPACE.Runtime.InteropServices.BuildTasks + +dotnet build-server shutdown + +msbuild -nodeReuse:False -t:Restore -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net6.0-windows -p:PerformAcceptanceTest=Runtime -p:AcceptanceTestFramework=net6 + +dotnet build-server shutdown + +msbuild -nodeReuse:False -t:Build -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net6.0-windows -p:PerformAcceptanceTest=Runtime -p:AcceptanceTestFramework=net6 -bl:%~dp0\net60x86.binlog +SET ERRUNTIMEX86_NET60=%ERRORLEVEL% + +msbuild -nodeReuse:False -t:Clean -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net6.0-windows -p:PerformAcceptanceTest=Runtime -p:AcceptanceTestFramework=net6 ..\CppLibrary\CppLibrary.vcxproj + +dotnet build-server shutdown + +msbuild -nodeReuse:False -t:Restore -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime + +dotnet build-server shutdown + +msbuild -nodeReuse:False -t:Build -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime -bl:%~dp0\net80x86.binlog +SET ERRUNTIMEX86_NET80=%ERRORLEVEL% + +msbuild -nodeReuse:False -t:Clean -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime ..\CppLibrary\CppLibrary.vcxproj + +dotnet build-server shutdown + +dotnet remove CsLibrary.csproj package dSPACE.Runtime.InteropServices.BuildTasks + +POPD + +SetLocal EnableDelayedExpansion + +SET EXITCODE=0 + +IF NOT "%ERRUNTIMEX86_NET80%" == "0" ( + ::SET EXITCODE=1 + ECHO "::warning::Runtime specific acceptance test for platform x86 using .NET 8.0 failed." +) + +IF NOT "%ERRUNTIMEX86_NET60%" == "0" ( + ::SET EXITCODE=1 + ECHO "::warning::Runtime specific acceptance test for platform x64 using .NET 6.0 failed." +) + +IF NOT EXIST %~dp0\..\CsLibrary\bin\x86\Release\net6.0-windows\CsLibrary.tlb ( + ::SET EXITCODE=1 + ECHO "::warning::Could not find exported TLB file for .NET 6 (x86)" +) + +IF NOT EXIST %~dp0\..\CsLibrary\bin\x86\Release\net8.0-windows\CsLibrary.tlb ( + ::SET EXITCODE=1 + ECHO "::warning::Could not find exported TLB file for .NET 8 (x86)" +) + +IF "%EXITCODE%" == "0" ( + ECHO "Acceptance test completed successfully." +) + +EXIT /B %EXITCODE% From 91e7f28b989028ca032301f2d5369b5d0083cf67 Mon Sep 17 00:00:00 2001 From: Carsten Igel Date: Wed, 20 Nov 2024 09:32:30 +0100 Subject: [PATCH 02/11] fix: Update acceptance test to run only on net8.0 --- examples/cppcli/CppLibrary/CppLibrary.vcxproj | 1 - examples/cppcli/CsLibrary/CsLibrary.csproj | 2 +- .../scripts/msbuild-acceptance-test.cmd | 25 ++----------------- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/examples/cppcli/CppLibrary/CppLibrary.vcxproj b/examples/cppcli/CppLibrary/CppLibrary.vcxproj index ad63b174..dddfb8a7 100644 --- a/examples/cppcli/CppLibrary/CppLibrary.vcxproj +++ b/examples/cppcli/CppLibrary/CppLibrary.vcxproj @@ -26,7 +26,6 @@ CppLibrary 10.0 net8.0 - net6.0 diff --git a/examples/cppcli/CsLibrary/CsLibrary.csproj b/examples/cppcli/CsLibrary/CsLibrary.csproj index 848cb823..4d7eabc5 100644 --- a/examples/cppcli/CsLibrary/CsLibrary.csproj +++ b/examples/cppcli/CsLibrary/CsLibrary.csproj @@ -1,7 +1,7 @@  - net6.0-windows;net8.0-windows + net8.0-windows enable enable True diff --git a/examples/cppcli/scripts/msbuild-acceptance-test.cmd b/examples/cppcli/scripts/msbuild-acceptance-test.cmd index e1c55b3a..8e6e563a 100644 --- a/examples/cppcli/scripts/msbuild-acceptance-test.cmd +++ b/examples/cppcli/scripts/msbuild-acceptance-test.cmd @@ -30,17 +30,6 @@ dotnet add CsLibrary.csproj package --no-restore --prerelease -s %root%\_package dotnet build-server shutdown -msbuild -nodeReuse:False -t:Restore -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net6.0-windows -p:PerformAcceptanceTest=Runtime -p:AcceptanceTestFramework=net6 - -dotnet build-server shutdown - -msbuild -nodeReuse:False -t:Build -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net6.0-windows -p:PerformAcceptanceTest=Runtime -p:AcceptanceTestFramework=net6 -bl:%~dp0\net60x86.binlog -SET ERRUNTIMEX86_NET60=%ERRORLEVEL% - -msbuild -nodeReuse:False -t:Clean -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net6.0-windows -p:PerformAcceptanceTest=Runtime -p:AcceptanceTestFramework=net6 ..\CppLibrary\CppLibrary.vcxproj - -dotnet build-server shutdown - msbuild -nodeReuse:False -t:Restore -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime dotnet build-server shutdown @@ -61,22 +50,12 @@ SetLocal EnableDelayedExpansion SET EXITCODE=0 IF NOT "%ERRUNTIMEX86_NET80%" == "0" ( - ::SET EXITCODE=1 + SET EXITCODE=1 ECHO "::warning::Runtime specific acceptance test for platform x86 using .NET 8.0 failed." ) -IF NOT "%ERRUNTIMEX86_NET60%" == "0" ( - ::SET EXITCODE=1 - ECHO "::warning::Runtime specific acceptance test for platform x64 using .NET 6.0 failed." -) - -IF NOT EXIST %~dp0\..\CsLibrary\bin\x86\Release\net6.0-windows\CsLibrary.tlb ( - ::SET EXITCODE=1 - ECHO "::warning::Could not find exported TLB file for .NET 6 (x86)" -) - IF NOT EXIST %~dp0\..\CsLibrary\bin\x86\Release\net8.0-windows\CsLibrary.tlb ( - ::SET EXITCODE=1 + SET EXITCODE=1 ECHO "::warning::Could not find exported TLB file for .NET 8 (x86)" ) From a4041130123ee682778847d5da2b85d217370100 Mon Sep 17 00:00:00 2001 From: Carsten Igel Date: Wed, 20 Nov 2024 09:33:27 +0100 Subject: [PATCH 03/11] ci: Don't change test matrix as quality gates depend on it --- .github/workflows/example-test.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/example-test.yaml b/.github/workflows/example-test.yaml index 4f16ebe8..73665ce6 100644 --- a/.github/workflows/example-test.yaml +++ b/.github/workflows/example-test.yaml @@ -12,13 +12,10 @@ jobs: test_suite: - name: OutProc path: outproc - requires_cpp: false - name: 32 Bit path: 32bit - requires_cpp: false - name: C++/CLI path: cppcli - requires_cpp: true steps: - uses: actions/checkout@v3 @@ -43,7 +40,6 @@ jobs: run: dotnet build -c Release - uses: ilammy/msvc-dev-cmd@v1 - if: ${{ matrix.test_suite.requires_cpp }} - name: Run ${{ matrix.test_suite.Name }} Acceptance test run: .\msbuild-acceptance-test.cmd From a6c9036504140d8f6eff6d0d36d7fc88e6688b41 Mon Sep 17 00:00:00 2001 From: Carsten Igel Date: Wed, 20 Nov 2024 11:15:38 +0100 Subject: [PATCH 04/11] ci: Update source location for packages --- examples/32bit/scripts/msbuild-acceptance-test.cmd | 2 ++ examples/cppcli/scripts/msbuild-acceptance-test.cmd | 4 +++- examples/outproc/scripts/msbuild-acceptance-test.cmd | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/32bit/scripts/msbuild-acceptance-test.cmd b/examples/32bit/scripts/msbuild-acceptance-test.cmd index 7dc5ec9e..5b707cca 100644 --- a/examples/32bit/scripts/msbuild-acceptance-test.cmd +++ b/examples/32bit/scripts/msbuild-acceptance-test.cmd @@ -10,6 +10,8 @@ dotnet pack src\dscom.build\dscom.build.csproj -p:Configuration=Release IF NOT EXIST %root%\_packages MKDIR _packages +XCOPY /Y /I /C /F .\src\dscom\bin\x64\Release\*.nupkg _packages\ +XCOPY /Y /I /C /F .\src\dscom.build\bin\x64\Release\*.nupkg _packages\ XCOPY /Y /I /C /F .\src\dscom\bin\Release\*.nupkg _packages\ XCOPY /Y /I /C /F .\src\dscom.build\bin\Release\*.nupkg _packages\ diff --git a/examples/cppcli/scripts/msbuild-acceptance-test.cmd b/examples/cppcli/scripts/msbuild-acceptance-test.cmd index 8e6e563a..86f12321 100644 --- a/examples/cppcli/scripts/msbuild-acceptance-test.cmd +++ b/examples/cppcli/scripts/msbuild-acceptance-test.cmd @@ -11,6 +11,8 @@ dotnet pack src\dscom.build\dscom.build.csproj -p:Configuration=Release IF NOT EXIST %root%\_packages MKDIR _packages +XCOPY /Y /I /C /F .\src\dscom\bin\x64\Release\*.nupkg _packages\ +XCOPY /Y /I /C /F .\src\dscom.build\bin\x64\Release\*.nupkg _packages\ XCOPY /Y /I /C /F .\src\dscom\bin\Release\*.nupkg _packages\ XCOPY /Y /I /C /F .\src\dscom.build\bin\Release\*.nupkg _packages\ @@ -55,7 +57,7 @@ IF NOT "%ERRUNTIMEX86_NET80%" == "0" ( ) IF NOT EXIST %~dp0\..\CsLibrary\bin\x86\Release\net8.0-windows\CsLibrary.tlb ( - SET EXITCODE=1 + ::SET EXITCODE=1 ECHO "::warning::Could not find exported TLB file for .NET 8 (x86)" ) diff --git a/examples/outproc/scripts/msbuild-acceptance-test.cmd b/examples/outproc/scripts/msbuild-acceptance-test.cmd index 04fafd63..af057802 100644 --- a/examples/outproc/scripts/msbuild-acceptance-test.cmd +++ b/examples/outproc/scripts/msbuild-acceptance-test.cmd @@ -10,6 +10,8 @@ dotnet pack -p:Configuration=Release IF NOT EXIST %root%\_packages MKDIR _packages +XCOPY /Y /I /C /F .\src\dscom\bin\x64\Release\*.nupkg _packages\ +XCOPY /Y /I /C /F .\src\dscom.build\bin\x64\Release\*.nupkg _packages\ XCOPY /Y /I /C /F .\src\dscom\bin\Release\*.nupkg _packages\ XCOPY /Y /I /C /F .\src\dscom.build\bin\Release\*.nupkg _packages\ From 3cc1c6e542db977e611bfc021e4f4151794f5179 Mon Sep 17 00:00:00 2001 From: Carsten Igel Date: Wed, 20 Nov 2024 11:59:22 +0100 Subject: [PATCH 05/11] qa: Fix restoration using dotnet cli vxproj compatibility is hell of a thing --- examples/cppcli/CsLibrary/CsLibrary.csproj | 2 +- examples/cppcli/scripts/msbuild-acceptance-test.cmd | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/cppcli/CsLibrary/CsLibrary.csproj b/examples/cppcli/CsLibrary/CsLibrary.csproj index 4d7eabc5..869da898 100644 --- a/examples/cppcli/CsLibrary/CsLibrary.csproj +++ b/examples/cppcli/CsLibrary/CsLibrary.csproj @@ -8,7 +8,7 @@ x86 - + diff --git a/examples/cppcli/scripts/msbuild-acceptance-test.cmd b/examples/cppcli/scripts/msbuild-acceptance-test.cmd index 86f12321..7e45bdae 100644 --- a/examples/cppcli/scripts/msbuild-acceptance-test.cmd +++ b/examples/cppcli/scripts/msbuild-acceptance-test.cmd @@ -25,10 +25,11 @@ POPD PUSHD %~dp0\..\CsLibrary msbuild -nodeReuse:False -t:Clean -p:Configuration=Release -p:PerformAcceptanceTest=Runtime -p:SkipResolvePackageAssets=true +msbuild -nodeReuse:False -t:Rebuild -p:Configuration=Release -p:PerformAcceptanceTest=Runtime -p:SkipResolvePackageAssets=true ..\CppLibrary\CppLibrary.vcxproj dotnet build-server shutdown -dotnet add CsLibrary.csproj package --no-restore --prerelease -s %root%\_packages dSPACE.Runtime.InteropServices.BuildTasks +dotnet add CsLibrary.csproj package --prerelease -s %root%\_packages dSPACE.Runtime.InteropServices.BuildTasks dotnet build-server shutdown From 04a9605ada9de50f0a13b67b223910179e6ff072 Mon Sep 17 00:00:00 2001 From: Carsten Igel Date: Wed, 20 Nov 2024 12:38:14 +0100 Subject: [PATCH 06/11] qa: Restore Cpp Project before Running restore on all projects --- examples/cppcli/scripts/msbuild-acceptance-test.cmd | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/cppcli/scripts/msbuild-acceptance-test.cmd b/examples/cppcli/scripts/msbuild-acceptance-test.cmd index 7e45bdae..b44f2be1 100644 --- a/examples/cppcli/scripts/msbuild-acceptance-test.cmd +++ b/examples/cppcli/scripts/msbuild-acceptance-test.cmd @@ -33,6 +33,7 @@ dotnet add CsLibrary.csproj package --prerelease -s %root%\_packages dSPACE.Runt dotnet build-server shutdown +msbuild -nodeReuse:False -t:Restore -p:Configuration=Release -p:Platform=x86 ..\CppLibrary\CppLibrary.vcxproj msbuild -nodeReuse:False -t:Restore -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime dotnet build-server shutdown From 4fb38651d779a508d2020f4b3f3c52a484aee562 Mon Sep 17 00:00:00 2001 From: Carsten Igel Date: Wed, 20 Nov 2024 12:48:01 +0100 Subject: [PATCH 07/11] qa: Add NuGet Restore to run create projects.assets.json Using an empty packages.config file --- examples/cppcli/CppLibrary/packages.config | 2 ++ examples/cppcli/scripts/msbuild-acceptance-test.cmd | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 examples/cppcli/CppLibrary/packages.config diff --git a/examples/cppcli/CppLibrary/packages.config b/examples/cppcli/CppLibrary/packages.config new file mode 100644 index 00000000..e2887c72 --- /dev/null +++ b/examples/cppcli/CppLibrary/packages.config @@ -0,0 +1,2 @@ + + diff --git a/examples/cppcli/scripts/msbuild-acceptance-test.cmd b/examples/cppcli/scripts/msbuild-acceptance-test.cmd index b44f2be1..a92383ed 100644 --- a/examples/cppcli/scripts/msbuild-acceptance-test.cmd +++ b/examples/cppcli/scripts/msbuild-acceptance-test.cmd @@ -33,7 +33,12 @@ dotnet add CsLibrary.csproj package --prerelease -s %root%\_packages dSPACE.Runt dotnet build-server shutdown -msbuild -nodeReuse:False -t:Restore -p:Configuration=Release -p:Platform=x86 ..\CppLibrary\CppLibrary.vcxproj +PUSHD %~dp0\..\CppLibrary + +nuget restore -SolutionDirectory .. + +POPD + msbuild -nodeReuse:False -t:Restore -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime dotnet build-server shutdown From 5d2ae0ccb482b7fb66f35749e6e77dcda6639e36 Mon Sep 17 00:00:00 2001 From: Carsten Igel Date: Wed, 20 Nov 2024 13:15:23 +0100 Subject: [PATCH 08/11] qa: Add CppLibrary nuget restore as first items --- .../cppcli/scripts/msbuild-acceptance-test.cmd | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/cppcli/scripts/msbuild-acceptance-test.cmd b/examples/cppcli/scripts/msbuild-acceptance-test.cmd index a92383ed..ac70e074 100644 --- a/examples/cppcli/scripts/msbuild-acceptance-test.cmd +++ b/examples/cppcli/scripts/msbuild-acceptance-test.cmd @@ -22,10 +22,16 @@ dotnet nuget locals global-packages --clear POPD +PUSHD %~dp0\..\CppLibrary + +nuget restore -SolutionDirectory .. +msbuild -nodeReuse:False -t:Rebuild -p:Configuration=Release -p:PerformAcceptanceTest=Runtime -p:SkipResolvePackageAssets=true + +POPD + PUSHD %~dp0\..\CsLibrary msbuild -nodeReuse:False -t:Clean -p:Configuration=Release -p:PerformAcceptanceTest=Runtime -p:SkipResolvePackageAssets=true -msbuild -nodeReuse:False -t:Rebuild -p:Configuration=Release -p:PerformAcceptanceTest=Runtime -p:SkipResolvePackageAssets=true ..\CppLibrary\CppLibrary.vcxproj dotnet build-server shutdown @@ -33,12 +39,6 @@ dotnet add CsLibrary.csproj package --prerelease -s %root%\_packages dSPACE.Runt dotnet build-server shutdown -PUSHD %~dp0\..\CppLibrary - -nuget restore -SolutionDirectory .. - -POPD - msbuild -nodeReuse:False -t:Restore -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime dotnet build-server shutdown From 7658e91924caaed35caaa6ba80a458e9b8dd0e7e Mon Sep 17 00:00:00 2001 From: Carsten Igel Date: Wed, 20 Nov 2024 13:25:17 +0100 Subject: [PATCH 09/11] qa: Swap Clean/Rebuild and Restore and add package assets --- examples/cppcli/scripts/msbuild-acceptance-test.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/cppcli/scripts/msbuild-acceptance-test.cmd b/examples/cppcli/scripts/msbuild-acceptance-test.cmd index ac70e074..3d19752c 100644 --- a/examples/cppcli/scripts/msbuild-acceptance-test.cmd +++ b/examples/cppcli/scripts/msbuild-acceptance-test.cmd @@ -24,8 +24,8 @@ POPD PUSHD %~dp0\..\CppLibrary +msbuild -nodeReuse:False -t:Clean -p:Configuration=Release -p:PerformAcceptanceTest=Runtime nuget restore -SolutionDirectory .. -msbuild -nodeReuse:False -t:Rebuild -p:Configuration=Release -p:PerformAcceptanceTest=Runtime -p:SkipResolvePackageAssets=true POPD @@ -39,7 +39,7 @@ dotnet add CsLibrary.csproj package --prerelease -s %root%\_packages dSPACE.Runt dotnet build-server shutdown -msbuild -nodeReuse:False -t:Restore -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime +msbuild -nodeReuse:False -t:Restore -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime -p:SkipResolvePackageAssets=true dotnet build-server shutdown From a71f0690a6541e5994450dbd2b5906011e15091a Mon Sep 17 00:00:00 2001 From: Carsten Igel Date: Wed, 20 Nov 2024 14:47:31 +0100 Subject: [PATCH 10/11] docs: Add Hint about 32 bit hostfxr --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index de39e52d..1ba185e1 100644 --- a/README.md +++ b/README.md @@ -376,6 +376,9 @@ Depending on whether you want to process 32bit or 64bit assemblies, you need to > To prevent this it is **recommended that the assembly is compiled as a 32 bit assembly** and not as an AnyCPU assembly. > see: +> Warning! +> In order to use 32 bit support with the build targets, the x86 version of .NET must be installed, as dscom requests the hostfxr.dll to be loaded. + ## Migration notes (mscorelib vs System.Private.CoreLib) Both assemblies are **ComVisible=false** but lot of .NET Framework types are **ComVisible=true**. From 109ec8a246f7a22e5d98a49134059ac64a7ff43a Mon Sep 17 00:00:00 2001 From: Carsten Igel Date: Wed, 20 Nov 2024 14:47:50 +0100 Subject: [PATCH 11/11] qa: Migrate test to x64 --- examples/cppcli/CsLibrary/CsLibrary.csproj | 2 +- .../cppcli/scripts/msbuild-acceptance-test.cmd | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/cppcli/CsLibrary/CsLibrary.csproj b/examples/cppcli/CsLibrary/CsLibrary.csproj index 869da898..a6fcbcf3 100644 --- a/examples/cppcli/CsLibrary/CsLibrary.csproj +++ b/examples/cppcli/CsLibrary/CsLibrary.csproj @@ -5,7 +5,7 @@ enable enable True - x86 + x64 diff --git a/examples/cppcli/scripts/msbuild-acceptance-test.cmd b/examples/cppcli/scripts/msbuild-acceptance-test.cmd index 3d19752c..e8126ed3 100644 --- a/examples/cppcli/scripts/msbuild-acceptance-test.cmd +++ b/examples/cppcli/scripts/msbuild-acceptance-test.cmd @@ -39,14 +39,14 @@ dotnet add CsLibrary.csproj package --prerelease -s %root%\_packages dSPACE.Runt dotnet build-server shutdown -msbuild -nodeReuse:False -t:Restore -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime -p:SkipResolvePackageAssets=true +msbuild -nodeReuse:False -t:Restore -p:Configuration=Release -p:Platform=x64 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime -p:SkipResolvePackageAssets=true dotnet build-server shutdown -msbuild -nodeReuse:False -t:Build -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime -bl:%~dp0\net80x86.binlog -SET ERRUNTIMEX86_NET80=%ERRORLEVEL% +msbuild -nodeReuse:False -t:Build -p:Configuration=Release -p:Platform=x64 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime -bl:%~dp0\net80x86.binlog +SET ERRUNTIMEX64_NET80=%ERRORLEVEL% -msbuild -nodeReuse:False -t:Clean -p:Configuration=Release -p:Platform=x86 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime ..\CppLibrary\CppLibrary.vcxproj +msbuild -nodeReuse:False -t:Clean -p:Configuration=Release -p:Platform=x64 -p:TargetPlatform=net8.0-windows -p:PerformAcceptanceTest=Runtime ..\CppLibrary\CppLibrary.vcxproj dotnet build-server shutdown @@ -58,14 +58,14 @@ SetLocal EnableDelayedExpansion SET EXITCODE=0 -IF NOT "%ERRUNTIMEX86_NET80%" == "0" ( +IF NOT "%ERRUNTIMEX64_NET80%" == "0" ( SET EXITCODE=1 - ECHO "::warning::Runtime specific acceptance test for platform x86 using .NET 8.0 failed." + ECHO "::warning::Runtime specific acceptance test for platform x64 using .NET 8.0 failed." ) -IF NOT EXIST %~dp0\..\CsLibrary\bin\x86\Release\net8.0-windows\CsLibrary.tlb ( +IF NOT EXIST %~dp0\..\CsLibrary\bin\x64\Release\net8.0-windows\CsLibrary.tlb ( ::SET EXITCODE=1 - ECHO "::warning::Could not find exported TLB file for .NET 8 (x86)" + ECHO "::warning::Could not find exported TLB file for .NET 8 (x64)" ) IF "%EXITCODE%" == "0" (