diff --git a/docs/workflow/testing/coreclr/windows-test-instructions.md b/docs/workflow/testing/coreclr/windows-test-instructions.md
index 3819907618b4b..dccf41f9b86bc 100644
--- a/docs/workflow/testing/coreclr/windows-test-instructions.md
+++ b/docs/workflow/testing/coreclr/windows-test-instructions.md
@@ -15,6 +15,22 @@ By default, the test build uses Release as the libraries configuration. To use a
src\tests\build.cmd /p:LibrariesConfiguration=Debug
```
+## Building Native Test Components
+
+Sometimes you want to only build the native test components instead of the managed and native components. To build the native test components only, pass the `skipmanaged` and `skipgeneratelayout` parameters to the build script as follows:
+
+```
+src\tests\build.cmd skipmanaged skipgeneratelayout
+```
+
+## Building C++/CLI native test components against the live ref assemblies
+
+By default, the C++/CLI native test components build against the ref pack from the SDK specified in the `global.json` file in the root of the repository. To build these components against the ref assemblies produced in the build, pass the `-cmakeargs -DCPP_CLI_LIVE_REF_ASSEMBLIES=1` parameters to the test build. For example:
+
+```
+src\tests\build.cmd skipmanaged -cmakeargs -DCPP_CLI_LIVE_REF_ASSEMBLIES=1
+```
+
## Building Precompiled Tests
```
diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp
index a41ed4c81a593..527fdcc3b1b62 100644
--- a/src/coreclr/vm/ceeload.cpp
+++ b/src/coreclr/vm/ceeload.cpp
@@ -5996,7 +5996,11 @@ static HMODULE GetIJWHostForModule(Module* module)
if ((importNameTable[thunkIndex].u1.Ordinal & (1LL << (sizeof(importNameTable[thunkIndex].u1.Ordinal) * CHAR_BIT - 1))) == 0)
{
IMAGE_IMPORT_BY_NAME* nameImport = (IMAGE_IMPORT_BY_NAME*)(baseAddress + importNameTable[thunkIndex].u1.AddressOfData);
- if (strcmp("_CorDllMain", nameImport->Name) == 0)
+ if (strcmp("_CorDllMain", nameImport->Name) == 0
+#ifdef TARGET_X86
+ || strcmp("__CorDllMain@12", nameImport->Name) == 0 // The MSVC compiler can and will bind to the stdcall-decorated name of _CorDllMain if it exists, even if the _CorDllMain symbol also exists.
+#endif
+ )
{
HMODULE ijwHost;
diff --git a/src/tests/Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler.cs b/src/tests/Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler.cs
index 7c04e2890f097..4b3008aa72dd0 100644
--- a/src/tests/Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler.cs
+++ b/src/tests/Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler.cs
@@ -20,7 +20,7 @@ static int Main(string[] args)
try
{
- Assembly ijwNativeDll = IjwHelper.LoadIjwAssembly("IjwCopyConstructorMarshaler");
+ Assembly ijwNativeDll = Assembly.Load("IjwCopyConstructorMarshaler");
Type testType = ijwNativeDll.GetType("TestClass");
object testInstance = Activator.CreateInstance(testType);
MethodInfo testMethod = testType.GetMethod("PInvokeNumCopies");
@@ -33,7 +33,7 @@ static int Main(string[] args)
// Reverse PInvoke will copy 3 times. Two are from the same paths as the PInvoke,
// and the third is from the reverse P/Invoke call.
Assert.AreEqual(3, (int)testMethod.Invoke(testInstance, null));
-
+
testMethod = testType.GetMethod("PInvokeNumCopiesDerivedType");
// PInvoke will copy twice. Once from argument to parameter, and once from the managed to native parameter.
diff --git a/src/tests/Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler.csproj b/src/tests/Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler.csproj
index 47e6c3d8060e2..1cebb6f073014 100644
--- a/src/tests/Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler.csproj
+++ b/src/tests/Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler.csproj
@@ -14,7 +14,6 @@
-
diff --git a/src/tests/Interop/IJW/FixupCallsHostWhenLoaded/FixupCallsHostWhenLoaded.cs b/src/tests/Interop/IJW/FixupCallsHostWhenLoaded/FixupCallsHostWhenLoaded.cs
index 9997f1d6857fc..5007ec3c80f0a 100644
--- a/src/tests/Interop/IJW/FixupCallsHostWhenLoaded/FixupCallsHostWhenLoaded.cs
+++ b/src/tests/Interop/IJW/FixupCallsHostWhenLoaded/FixupCallsHostWhenLoaded.cs
@@ -21,8 +21,7 @@ static int Main(string[] args)
try
{
- // Load a fake mscoree.dll to avoid starting desktop
- IntPtr ijwHost = NativeLibrary.Load(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "mscoree.dll"));
+ IntPtr ijwHost = NativeLibrary.Load(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ijwhost.dll"));
WasModuleVTableQueriedDelegate wasModuleVTableQueried = Marshal.GetDelegateForFunctionPointer(NativeLibrary.GetExport(ijwHost, "WasModuleVTableQueried"));
@@ -30,7 +29,7 @@ static int Main(string[] args)
Assembly.Load("IjwNativeDll");
IntPtr ijwModuleHandle = GetModuleHandle("IjwNativeDll.dll");
-
+
Assert.AreNotEqual(IntPtr.Zero, ijwModuleHandle);
Assert.IsTrue(wasModuleVTableQueried(ijwModuleHandle));
}
diff --git a/src/tests/Interop/IJW/FixupCallsHostWhenLoaded/FixupCallsHostWhenLoaded.csproj b/src/tests/Interop/IJW/FixupCallsHostWhenLoaded/FixupCallsHostWhenLoaded.csproj
index 4343f56386fa4..d6cec7a1845e1 100644
--- a/src/tests/Interop/IJW/FixupCallsHostWhenLoaded/FixupCallsHostWhenLoaded.csproj
+++ b/src/tests/Interop/IJW/FixupCallsHostWhenLoaded/FixupCallsHostWhenLoaded.csproj
@@ -14,7 +14,6 @@
-
diff --git a/src/tests/Interop/IJW/IJW.cmake b/src/tests/Interop/IJW/IJW.cmake
index b78fcb2bb169a..15afbde14cf0d 100644
--- a/src/tests/Interop/IJW/IJW.cmake
+++ b/src/tests/Interop/IJW/IJW.cmake
@@ -3,7 +3,7 @@ if (CLR_CMAKE_HOST_WIN32)
add_compile_options(/wd4365)
# IJW
- add_compile_options(/clr)
+ add_compile_options(/clr:netcore)
# IJW requires the CRT as a dll, not linked in
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$,$>:Debug>DLL)
@@ -27,4 +27,32 @@ if (CLR_CMAKE_HOST_WIN32)
string(REPLACE "/GR-" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()
+ set(CLR_SDK_REF_PACK "")
+ set(CLR_SDK_REF_PACK_DISCOVERY_ERROR "")
+ set(CLR_SDK_REF_PACK_DISCOVERY_RESULT 0)
+
+ if (CPP_CLI_LIVE_REF_ASSEMBLIES)
+ message("Using live-built ref assemblies for C++/CLI runtime tests.")
+ execute_process(
+ COMMAND powershell -ExecutionPolicy ByPass -NoProfile "${CMAKE_CURRENT_LIST_DIR}/getRefPackFolderFromArtifacts.ps1"
+ OUTPUT_VARIABLE CLR_SDK_REF_PACK
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE CLR_SDK_REF_PACK_DISCOVERY_ERROR
+ RESULT_VARIABLE CLR_SDK_REF_PACK_DISCOVERY_RESULT)
+ else()
+ execute_process(
+ COMMAND powershell -ExecutionPolicy ByPass -NoProfile "${CMAKE_CURRENT_LIST_DIR}/getRefPackFolderFromSdk.ps1"
+ OUTPUT_VARIABLE CLR_SDK_REF_PACK
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE CLR_SDK_REF_PACK_DISCOVERY_ERROR
+ RESULT_VARIABLE CLR_SDK_REF_PACK_DISCOVERY_RESULT)
+ endif()
+
+ if (NOT CLR_SDK_REF_PACK_DISCOVERY_RESULT EQUAL 0)
+ message(FATAL_ERROR "Unable to find reference assemblies: ${CLR_SDK_REF_PACK_DISCOVERY_ERROR}")
+ endif()
+
+ add_compile_options(/AI${CLR_SDK_REF_PACK})
+
+ list(APPEND LINK_LIBRARIES_ADDITIONAL ijwhost)
endif()
diff --git a/src/tests/Interop/IJW/IjwHelper.cs b/src/tests/Interop/IJW/IjwHelper.cs
deleted file mode 100644
index 007229b8a1880..0000000000000
--- a/src/tests/Interop/IJW/IjwHelper.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using TestLibrary;
-
-class IjwHelper
-{
- private const string ijwHostName = "mscoree.dll";
-
- public static Assembly LoadIjwAssembly(string name)
- {
- // Load our mock ijwhost before we load the IJW assembly.
- NativeLibrary.Load(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), ijwHostName));
-
- return Assembly.Load(name);
- }
-}
diff --git a/src/tests/Interop/IJW/LoadIjwFromModuleHandle/LoadIjwFromModuleHandle.cs b/src/tests/Interop/IJW/LoadIjwFromModuleHandle/LoadIjwFromModuleHandle.cs
index 6dca0e8853e8d..cdcacd6b3eb2a 100644
--- a/src/tests/Interop/IJW/LoadIjwFromModuleHandle/LoadIjwFromModuleHandle.cs
+++ b/src/tests/Interop/IJW/LoadIjwFromModuleHandle/LoadIjwFromModuleHandle.cs
@@ -26,9 +26,6 @@ unsafe static int Main(string[] args)
{
HostPolicyMock.Initialize(Environment.CurrentDirectory, null);
- // Load our fake mscoree to prevent .NET Framework from loading.
- NativeLibrary.Load(Path.Combine(Environment.CurrentDirectory, "mscoree.dll"));
-
Console.WriteLine("Verify that we can load an IJW assembly from native code.");
string ijwModulePath = Path.Combine(Environment.CurrentDirectory, "IjwNativeCallingManagedDll.dll");
IntPtr ijwNativeHandle = NativeLibrary.Load(ijwModulePath);
@@ -42,7 +39,7 @@ unsafe static int Main(string[] args)
{
InMemoryAssemblyLoader.LoadInMemoryAssembly(ijwNativeHandle, (IntPtr)path);
}
-
+
NativeEntryPointDelegate nativeEntryPoint = Marshal.GetDelegateForFunctionPointer(NativeLibrary.GetExport(ijwNativeHandle, "NativeEntryPoint"));
Assert.AreEqual(100, nativeEntryPoint());
@@ -63,7 +60,7 @@ unsafe static int Main(string[] args)
changeReturnedValueMethod.Invoke(null, new object[] { newValue });
Assert.AreEqual(newValue, (int)getReturnValueMethod.Invoke(null, null));
-
+
// Native images are only loaded into memory once. As a result, the stubs in the vtfixup table
// will always point to JIT stubs that exist in the first ALC that the module was loaded into.
// As a result, if an IJW module is loaded into two different ALCs, or if the module is
diff --git a/src/tests/Interop/IJW/ManagedCallingNative/ManagedCallingNative.cs b/src/tests/Interop/IJW/ManagedCallingNative/ManagedCallingNative.cs
index 6fbd95199e0ff..19910a66d973a 100644
--- a/src/tests/Interop/IJW/ManagedCallingNative/ManagedCallingNative.cs
+++ b/src/tests/Interop/IJW/ManagedCallingNative/ManagedCallingNative.cs
@@ -20,7 +20,7 @@ static int Main(string[] args)
}
bool success = true;
- Assembly ijwNativeDll = IjwHelper.LoadIjwAssembly("IjwNativeDll");
+ Assembly ijwNativeDll = Assembly.Load("IjwNativeDll");
TestFramework.BeginTestCase("Call native method returning int");
Type testType = ijwNativeDll.GetType("TestClass");
@@ -45,19 +45,7 @@ static int Main(string[] args)
catch { }
TestFramework.EndTestCase();
- TestFramework.BeginTestCase("Ensure .NET Framework was not loaded");
- IntPtr clrHandle = GetModuleHandle("mscoreei.dll");
- if (clrHandle != IntPtr.Zero)
- {
- TestFramework.LogError("IJW", ".NET Framework loaded by IJw module load");
- success = false;
- }
- TestFramework.EndTestCase();
-
return success ? 100 : 99;
}
-
- [DllImport("kernel32.dll")]
- static extern IntPtr GetModuleHandle(string lpModuleName);
}
}
diff --git a/src/tests/Interop/IJW/ManagedCallingNative/ManagedCallingNative.csproj b/src/tests/Interop/IJW/ManagedCallingNative/ManagedCallingNative.csproj
index f9af5043b8faf..858100113ee54 100644
--- a/src/tests/Interop/IJW/ManagedCallingNative/ManagedCallingNative.csproj
+++ b/src/tests/Interop/IJW/ManagedCallingNative/ManagedCallingNative.csproj
@@ -14,7 +14,6 @@
-
diff --git a/src/tests/Interop/IJW/NativeCallingManaged/NativeCallingManaged.cs b/src/tests/Interop/IJW/NativeCallingManaged/NativeCallingManaged.cs
index adf1ac4b4d769..95516edb90ef0 100644
--- a/src/tests/Interop/IJW/NativeCallingManaged/NativeCallingManaged.cs
+++ b/src/tests/Interop/IJW/NativeCallingManaged/NativeCallingManaged.cs
@@ -20,7 +20,7 @@ static int Main(string[] args)
}
bool success = true;
- Assembly ijwNativeDll = IjwHelper.LoadIjwAssembly("IjwNativeCallingManagedDll");
+ Assembly ijwNativeDll = Assembly.Load("IjwNativeCallingManagedDll");
TestFramework.BeginTestCase("Call native method returning int");
Type testType = ijwNativeDll.GetType("TestClass");
@@ -34,19 +34,7 @@ static int Main(string[] args)
}
TestFramework.EndTestCase();
- TestFramework.BeginTestCase("Ensure .NET Framework was not loaded");
- IntPtr clrHandle = GetModuleHandle("mscoreei.dll");
- if (clrHandle != IntPtr.Zero)
- {
- TestFramework.LogError("IJW", ".NET Framework loaded by IJw module load");
- success = false;
- }
- TestFramework.EndTestCase();
-
return success ? 100 : 99;
}
-
- [DllImport("kernel32.dll")]
- static extern IntPtr GetModuleHandle(string lpModuleName);
}
}
diff --git a/src/tests/Interop/IJW/NativeCallingManaged/NativeCallingManaged.csproj b/src/tests/Interop/IJW/NativeCallingManaged/NativeCallingManaged.csproj
index e2699c214d49a..9ea4b4cde8a49 100644
--- a/src/tests/Interop/IJW/NativeCallingManaged/NativeCallingManaged.csproj
+++ b/src/tests/Interop/IJW/NativeCallingManaged/NativeCallingManaged.csproj
@@ -14,7 +14,6 @@
-
diff --git a/src/tests/Interop/IJW/NativeVarargs/IjwNativeVarargs.cpp b/src/tests/Interop/IJW/NativeVarargs/IjwNativeVarargs.cpp
index 23b382365b180..a2b9cc92ce858 100644
--- a/src/tests/Interop/IJW/NativeVarargs/IjwNativeVarargs.cpp
+++ b/src/tests/Interop/IJW/NativeVarargs/IjwNativeVarargs.cpp
@@ -8,7 +8,8 @@
#include
#include
#include
-#using
+#using
+#using
using namespace System::Collections::Generic;
public enum class TestCases
diff --git a/src/tests/Interop/IJW/NativeVarargs/NativeVarargsTest.cs b/src/tests/Interop/IJW/NativeVarargs/NativeVarargsTest.cs
index abc8374353b6b..ffbf04eda1d30 100644
--- a/src/tests/Interop/IJW/NativeVarargs/NativeVarargsTest.cs
+++ b/src/tests/Interop/IJW/NativeVarargs/NativeVarargsTest.cs
@@ -26,7 +26,7 @@ static int Main(string[] args)
try
{
- Assembly ijwNativeDll = IjwHelper.LoadIjwAssembly("IjwNativeVarargs");
+ Assembly ijwNativeDll = Assembly.Load("IjwNativeVarargs");
Type testType = ijwNativeDll.GetType("TestClass");
object testInstance = Activator.CreateInstance(testType);
MethodInfo testMethod = testType.GetMethod("RunTests");
diff --git a/src/tests/Interop/IJW/NativeVarargs/NativeVarargsTest.csproj b/src/tests/Interop/IJW/NativeVarargs/NativeVarargsTest.csproj
index 157d90264bc02..b8d593f7ba87c 100644
--- a/src/tests/Interop/IJW/NativeVarargs/NativeVarargsTest.csproj
+++ b/src/tests/Interop/IJW/NativeVarargs/NativeVarargsTest.csproj
@@ -16,7 +16,6 @@
-
diff --git a/src/tests/Interop/IJW/getRefPackFolderFromArtifacts.ps1 b/src/tests/Interop/IJW/getRefPackFolderFromArtifacts.ps1
new file mode 100644
index 0000000000000..aaf5e93661ae3
--- /dev/null
+++ b/src/tests/Interop/IJW/getRefPackFolderFromArtifacts.ps1
@@ -0,0 +1,21 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+$interopFolder = Split-Path $PSScriptRoot -Parent
+$testsFolder = Split-Path $interopFolder -Parent
+$srcFolder = Split-Path $testsFolder -Parent
+$repoRoot = Split-Path $srcFolder -Parent
+
+$versionPropsFile = "$repoRoot/eng/Versions.props"
+
+$majorVersion = Select-Xml -Path $versionPropsFile -XPath "/Project/PropertyGroup/MajorVersion" | %{$_.Node.InnerText}
+$minorVersion = Select-Xml -Path $versionPropsFile -XPath "/Project/PropertyGroup/MinorVersion" | %{$_.Node.InnerText}
+
+$refPackPath = "$repoRoot/artifacts/bin/ref/net$majorVersion.$minorVersion"
+
+if (-not (Test-Path $refPackPath))
+{
+ Write-Error "Reference assemblies not found in the artifacts folder at '$refPackPath'. Did you build the libs.ref subset? Did the repo layout change?"
+ return 1
+}
+
+Write-Output $refPackPath
diff --git a/src/tests/Interop/IJW/getRefPackFolderFromSdk.ps1 b/src/tests/Interop/IJW/getRefPackFolderFromSdk.ps1
new file mode 100644
index 0000000000000..bb2404d27a626
--- /dev/null
+++ b/src/tests/Interop/IJW/getRefPackFolderFromSdk.ps1
@@ -0,0 +1,28 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+$interopFolder = Split-Path $PSScriptRoot -Parent
+$testsFolder = Split-Path $interopFolder -Parent
+$srcFolder = Split-Path $testsFolder -Parent
+$repoRoot = Split-Path $srcFolder -Parent
+
+
+. "$repoRoot/eng/common/tools.ps1"
+
+$dotnetRoot = InitializeDotNetCli $true $false
+
+$dotnetSdkVersion = $GlobalJson.tools.dotnet
+
+$sdkBundledVersionsFile = "$dotnetRoot/sdk/$dotnetSdkVersion/Microsoft.NETCoreSdk.BundledVersions.props"
+
+$refPackVersion = Select-Xml -Path $sdkBundledVersionsFile -XPath "/Project/PropertyGroup/BundledNETCoreAppPackageVersion" | %{$_.Node.InnerText}
+$refPackTfmVersion = Select-Xml -Path $sdkBundledVersionsFile -XPath "/Project/PropertyGroup/BundledNETCoreAppTargetFrameworkVersion" | %{$_.Node.InnerText}
+
+$refPackPath = "$dotnetRoot/packs/Microsoft.NETCore.App.Ref/$refPackVersion/ref/net$refPackTfmVersion"
+
+if (-not (Test-Path $refPackPath))
+{
+ Write-Error "Reference assemblies not found in the SDK folder. Did the SDK layout change? Did the SDK change how it describes the bundled runtime version?"
+ return 1
+}
+
+Write-Output $refPackPath
diff --git a/src/tests/Interop/IJW/ijwhostmock/CMakeLists.txt b/src/tests/Interop/IJW/ijwhostmock/CMakeLists.txt
index df4b193419572..b6bbd047ab37f 100644
--- a/src/tests/Interop/IJW/ijwhostmock/CMakeLists.txt
+++ b/src/tests/Interop/IJW/ijwhostmock/CMakeLists.txt
@@ -1,10 +1,10 @@
project (mscoree)
include_directories( ${INC_PLATFORM_DIR} )
-set(SOURCES mscoree.cpp)
+set(SOURCES ijwhost.cpp)
# add the shared library
-add_library (mscoree SHARED ${SOURCES})
-target_link_libraries(mscoree ${LINK_LIBRARIES_ADDITIONAL})
+add_library (ijwhost SHARED ${SOURCES})
+target_link_libraries(ijwhost ${LINK_LIBRARIES_ADDITIONAL})
# add the install targets
-install (TARGETS mscoree DESTINATION bin)
+install (TARGETS ijwhost DESTINATION bin)
diff --git a/src/tests/Interop/IJW/ijwhostmock/mscoree.cpp b/src/tests/Interop/IJW/ijwhostmock/ijwhost.cpp
similarity index 79%
rename from src/tests/Interop/IJW/ijwhostmock/mscoree.cpp
rename to src/tests/Interop/IJW/ijwhostmock/ijwhost.cpp
index 8c466d3996f42..abc554b81b9f8 100644
--- a/src/tests/Interop/IJW/ijwhostmock/mscoree.cpp
+++ b/src/tests/Interop/IJW/ijwhostmock/ijwhost.cpp
@@ -8,9 +8,6 @@
std::set g_modulesQueried = {};
#if defined HOST_X86
-// We need to use a double-underscore here because the VC linker drops the first underscore
-// to help people who are exporting cdecl functions to easily export the right thing.
-#pragma comment(linker, "/export:__CorDllMain=__CorDllMain@12")
#pragma comment(linker, "/export:GetTokenForVTableEntry=_GetTokenForVTableEntry@8")
#endif
diff --git a/src/tests/build.cmd b/src/tests/build.cmd
index cb8834ad0b021..9848704cd45d5 100644
--- a/src/tests/build.cmd
+++ b/src/tests/build.cmd
@@ -56,6 +56,7 @@ set __CopyNativeProjectsAfterCombinedTestBuild=true
set __SkipGenerateLayout=0
set __GenerateLayoutOnly=0
set __Ninja=1
+set __CMakeArgs=
@REM CMD has a nasty habit of eating "=" on the argument list, so passing:
@REM -priority=1
@@ -97,7 +98,7 @@ if /i "%1" == "skipgeneratelayout" (set __SkipGenerateLayout=1&set processedA
if /i "%1" == "copynativeonly" (set __CopyNativeTestBinaries=1&set __SkipNative=1&set __CopyNativeProjectsAfterCombinedTestBuild=false&set __SkipGenerateLayout=1&set __SkipTestWrappers=1&set __SkipCrossgenFramework=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "generatelayoutonly" (set __SkipManaged=1&set __SkipNative=1&set __CopyNativeProjectsAfterCombinedTestBuild=false&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "buildtestwrappersonly" (set __SkipNative=1&set __SkipManaged=1&set __BuildTestWrappersOnly=1&set __SkipGenerateLayout=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-
+if /i "%1" == "-cmakeargs" (set __CMakeArgs="%2=%3" %__CMakeArgs%&set "processedArgs=!processedArgs! %1 %2=%3"&shift&shift&goto Arg_Loop)
if /i "%1" == "-msbuild" (set __Ninja=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "buildagainstpackages" (echo error: Remove /BuildAgainstPackages switch&&exit /b1)
if /i "%1" == "crossgen2" (set __DoCrossgen2=1&set __TestBuildMode=crossgen2&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
@@ -220,7 +221,7 @@ if %__Ninja% EQU 1 (
) else (
set __ExtraCmakeArgs="-DCMAKE_SYSTEM_VERSION=10.0"
)
-call "%__RepoRootDir%\eng\native\gen-buildsys.cmd" "%__ProjectFilesDir%" "%__NativeTestIntermediatesDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs!
+call "%__RepoRootDir%\eng\native\gen-buildsys.cmd" "%__ProjectFilesDir%" "%__NativeTestIntermediatesDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs! !__CMakeArgs!
if not !errorlevel! == 0 (
echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate native component build project!