Ver código fonte

Use libnethost to find hostfxr (#39810)

Hao Kung 4 anos atrás
pai
commit
6378cdabe3
45 arquivos alterados com 743 adições e 2033 exclusões
  1. 21 2
      AspNetCore.sln
  2. 1 0
      eng/tools/GenerateFiles/Directory.Build.props.in
  3. 1 0
      eng/tools/GenerateFiles/GenerateFiles.csproj
  4. 7 210
      src/Servers/IIS/AspNetCoreModuleV2/AspNetCore/AspNetCore.vcxproj
  5. 4 192
      src/Servers/IIS/AspNetCoreModuleV2/CommonLib/CommonLib.vcxproj
  6. 2 0
      src/Servers/IIS/AspNetCoreModuleV2/CommonLib/GlobalVersionUtility.h
  7. 79 75
      src/Servers/IIS/AspNetCoreModuleV2/CommonLib/HostFxrResolver.cpp
  8. 8 13
      src/Servers/IIS/AspNetCoreModuleV2/CommonLib/HostFxrResolver.h
  9. 1 1
      src/Servers/IIS/AspNetCoreModuleV2/CommonLib/StringHelpers.cpp
  10. 1 1
      src/Servers/IIS/AspNetCoreModuleV2/CommonLib/StringHelpers.h
  11. 308 305
      src/Servers/IIS/AspNetCoreModuleV2/CommonLib/fx_ver.cpp
  12. 47 45
      src/Servers/IIS/AspNetCoreModuleV2/CommonLib/fx_ver.h
  13. 0 67
      src/Servers/IIS/AspNetCoreModuleV2/CommonLib/hostfxroptions.cpp
  14. 0 61
      src/Servers/IIS/AspNetCoreModuleV2/CommonLib/hostfxroptions.h
  15. 15 155
      src/Servers/IIS/AspNetCoreModuleV2/CommonLibTests/CommonLibTests.vcxproj
  16. 1 1
      src/Servers/IIS/AspNetCoreModuleV2/CommonLibTests/dotnet_exe_path_tests.cpp
  17. 6 8
      src/Servers/IIS/AspNetCoreModuleV2/IISLib/IISLib.vcxproj
  18. 4 215
      src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/InProcessRequestHandler.vcxproj
  19. 4 215
      src/Servers/IIS/AspNetCoreModuleV2/OutOfProcessRequestHandler/OutOfProcessRequestHandler.vcxproj
  20. 3 186
      src/Servers/IIS/AspNetCoreModuleV2/RequestHandlerLib/RequestHandlerLib.vcxproj
  21. 5 157
      src/Servers/IIS/AspNetCoreModuleV2/gtest/gtest.vcxproj
  22. 7 0
      src/Servers/IIS/Directory.Build.props
  23. 0 1
      src/Servers/IIS/IIS/test/Common.FunctionalTests/FrebTests.cs
  24. 8 5
      src/Servers/IIS/IIS/test/Common.FunctionalTests/GlobalVersionTests.cs
  25. 0 1
      src/Servers/IIS/IIS/test/Common.FunctionalTests/LoggingTests.cs
  26. 0 1
      src/Servers/IIS/IIS/test/Common.FunctionalTests/MaxRequestBodySizeTests.cs
  27. 0 2
      src/Servers/IIS/IIS/test/Common.FunctionalTests/MultiApplicationTests.cs
  28. 0 7
      src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs
  29. 0 8
      src/Servers/IIS/IIS/test/Common.LongTests/StartupTests.cs
  30. 1 0
      src/Servers/IIS/IIS/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj
  31. 1 0
      src/Servers/IIS/IIS/test/IIS.NewHandler.FunctionalTests/IIS.NewHandler.FunctionalTests.csproj
  32. 1 0
      src/Servers/IIS/IIS/test/IIS.NewShim.FunctionalTests/IIS.NewShim.FunctionalTests.csproj
  33. 0 2
      src/Servers/IIS/IIS/test/IIS.NewShim.FunctionalTests/NewShimTests.cs
  34. 1 0
      src/Servers/IIS/IIS/test/IIS.ShadowCopy.Tests/IIS.ShadowCopy.Tests.csproj
  35. 1 0
      src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj
  36. 1 0
      src/Servers/IIS/IISIntegration.slnf
  37. 64 0
      src/Servers/IIS/build/Build.Common.Settings
  38. 32 0
      src/Servers/IIS/build/Build.Dll.Settings
  39. 17 0
      src/Servers/IIS/build/Build.Lib.Settings
  40. 0 95
      src/Servers/IIS/build/Build.Settings
  41. 8 0
      src/Servers/IIS/build/Config.Definitions.Props
  42. 30 0
      src/Servers/IIS/build/debug.props
  43. 42 0
      src/Servers/IIS/build/release.props
  44. 4 2
      src/Servers/IIS/tools/GenerateNativeAssets.ps1
  45. 7 0
      src/Servers/test/FunctionalTests/HelloWorldTest.cs

+ 21 - 2
AspNetCore.sln

@@ -1662,6 +1662,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LinkabilityChecker", "Linka
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LinkabilityChecker", "src\Tools\LinkabilityChecker\LinkabilityChecker.csproj", "{EA7D844B-C180-41C7-9D55-273AD88BF71F}"
 EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IIS.LongTests", "src\Servers\IIS\IIS\test\IIS.LongTests\IIS.LongTests.csproj", "{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -7500,8 +7502,8 @@ Global
 		{65EC29AD-91CA-49BA-B1FC-D3DF127BE887}.Debug|Any CPU.Build.0 = Debug|x64
 		{65EC29AD-91CA-49BA-B1FC-D3DF127BE887}.Debug|arm64.ActiveCfg = Debug|ARM64
 		{65EC29AD-91CA-49BA-B1FC-D3DF127BE887}.Debug|arm64.Build.0 = Debug|ARM64
-		{65EC29AD-91CA-49BA-B1FC-D3DF127BE887}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{65EC29AD-91CA-49BA-B1FC-D3DF127BE887}.Debug|x64.Build.0 = Debug|Any CPU
+		{65EC29AD-91CA-49BA-B1FC-D3DF127BE887}.Debug|x64.ActiveCfg = Debug|x64
+		{65EC29AD-91CA-49BA-B1FC-D3DF127BE887}.Debug|x64.Build.0 = Debug|x64
 		{65EC29AD-91CA-49BA-B1FC-D3DF127BE887}.Debug|x86.ActiveCfg = Debug|x86
 		{65EC29AD-91CA-49BA-B1FC-D3DF127BE887}.Debug|x86.Build.0 = Debug|x86
 		{65EC29AD-91CA-49BA-B1FC-D3DF127BE887}.Release|Any CPU.ActiveCfg = Release|x64
@@ -9954,6 +9956,22 @@ Global
 		{EA7D844B-C180-41C7-9D55-273AD88BF71F}.Release|x64.Build.0 = Release|Any CPU
 		{EA7D844B-C180-41C7-9D55-273AD88BF71F}.Release|x86.ActiveCfg = Release|Any CPU
 		{EA7D844B-C180-41C7-9D55-273AD88BF71F}.Release|x86.Build.0 = Release|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Debug|arm64.ActiveCfg = Debug|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Debug|arm64.Build.0 = Debug|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Debug|x64.Build.0 = Debug|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Debug|x86.Build.0 = Debug|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Release|Any CPU.Build.0 = Release|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Release|arm64.ActiveCfg = Release|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Release|arm64.Build.0 = Release|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Release|x64.ActiveCfg = Release|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Release|x64.Build.0 = Release|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Release|x86.ActiveCfg = Release|Any CPU
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04}.Release|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -10776,6 +10794,7 @@ Global
 		{DC349A25-0DBF-4468-99E1-B95C22D3A7EF} = {CC45FA2D-128B-485D-BA6D-DFD9735CB3C3}
 		{94F95276-7CDF-44A8-B159-D09702EF6794} = {0B200A66-B809-4ED3-A790-CB1C2E80975E}
 		{EA7D844B-C180-41C7-9D55-273AD88BF71F} = {94F95276-7CDF-44A8-B159-D09702EF6794}
+		{B7DAA48B-8E5E-4A5D-9FEB-E6D49AE76A04} = {41BB7BA4-AC08-4E9A-83EA-6D587A5B951C}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {3E8720B3-DBDD-498C-B383-2CC32A054E8F}

+ 1 - 0
eng/tools/GenerateFiles/Directory.Build.props.in

@@ -2,5 +2,6 @@
   <PropertyGroup>
     <DefaultNetCoreTargetFramework>${DefaultNetCoreTargetFramework}</DefaultNetCoreTargetFramework>
     <TreatWarningsAsErrors Condition="'$(BuildingInsideVisualStudio)' != 'true'">true</TreatWarningsAsErrors>
+    <LibNetHostAppPackVersion Condition=" '$(LibNetHostAppPackVersion)' == '' ">${LibNetHostAppPackVersion}</LibNetHostAppPackVersion>
   </PropertyGroup>
 </Project>

+ 1 - 0
eng/tools/GenerateFiles/GenerateFiles.csproj

@@ -19,6 +19,7 @@
         MicrosoftAspNetCoreAppRuntimeVersion=$(SharedFxVersion);
         MicrosoftNETCoreAppRefVersion=$(MicrosoftNETCoreAppRefVersion);
         MicrosoftNETCoreAppRuntimeVersion=$(MicrosoftNETCoreAppRuntimeVersion);
+        LibNetHostAppPackVersion=$(BundledNETCoreAppPackageVersion);
         SupportedRuntimeIdentifiers=$(SupportedRuntimeIdentifiers.Trim())
       </_TemplateProperties>
     </PropertyGroup>

+ 7 - 210
src/Servers/IIS/AspNetCoreModuleV2/AspNetCore/AspNetCore.vcxproj

@@ -1,236 +1,33 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|ARM64">
-      <Configuration>Debug</Configuration>
-      <Platform>ARM64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Any CPU">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|ARM64">
-      <Configuration>Release</Configuration>
-      <Platform>ARM64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Any CPU">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
   <PropertyGroup Label="Globals">
     <ProjectGuid>{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}</ProjectGuid>
-    <Keyword>Win32Proj</Keyword>
     <RootNamespace>AspNetCoreModule</RootNamespace>
     <ProjectName>AspNetCore</ProjectName>
     <TargetName>aspnetcorev2</TargetName>
     <LinkIncremental>false</LinkIncremental>
-    <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
-    <PlatformToolsetVersion Condition=" '$(VisualStudioVersion)' == '17.0' ">v143</PlatformToolsetVersion>
-    <PlatformToolsetVersion Condition=" '$(PlatformToolsetVersion)' == '' ">v142</PlatformToolsetVersion>
     <OutDirName>AspNetCoreModuleShim</OutDirName>
   </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Label="Configuration">
-    <VCToolsVersion />
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32' OR '$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Debug|ARM64' OR '$(Configuration)|$(Platform)'=='Debug|Any CPU'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32' OR '$(Configuration)|$(Platform)'=='Release|x64' OR '$(Configuration)|$(Platform)'=='Release|ARM64' OR '$(Configuration)|$(Platform)'=='Release|Any CPU'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <Import Project="..\..\build\Build.Settings" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+  <Import Project="..\..\build\Build.Dll.Settings" />
+  <ItemDefinitionGroup>
     <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <AdditionalIncludeDirectories>..\IISLib;.\Inc;..\CommonLib</AdditionalIncludeDirectories>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <SDLCheck>true</SDLCheck>
-      <WholeProgramOptimization>true</WholeProgramOptimization>
-      <PreprocessKeepComments>false</PreprocessKeepComments>
-      <ExceptionHandling>SyncCThrow</ExceptionHandling>
-      <StructMemberAlignment>8Bytes</StructMemberAlignment>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <RuntimeTypeInfo>false</RuntimeTypeInfo>
-      <OmitDefaultLibName>true</OmitDefaultLibName>
-      <CompileAs>CompileAsCpp</CompileAs>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
+      <PreprocessorDefinitions>_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>..\IISLib;.\Inc;..\CommonLib;$(LibNetHostPath)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib</AdditionalDependencies>
-      <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+      <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib;libnethost.lib</AdditionalDependencies>
     </Link>
     <ResourceCompile>
       <AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
     </ResourceCompile>
   </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Debug|ARM64' OR '$(Configuration)|$(Platform)'=='Debug|Any CPU'">
+  <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
     <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <AdditionalIncludeDirectories>..\IISLib;.\Inc;..\CommonLib</AdditionalIncludeDirectories>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <SDLCheck>true</SDLCheck>
-      <WholeProgramOptimization>true</WholeProgramOptimization>
-      <PreprocessKeepComments>false</PreprocessKeepComments>
-      <ExceptionHandling>SyncCThrow</ExceptionHandling>
-      <StructMemberAlignment>8Bytes</StructMemberAlignment>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <RuntimeTypeInfo>false</RuntimeTypeInfo>
-      <OmitDefaultLibName>true</OmitDefaultLibName>
-      <CompileAs>CompileAsCpp</CompileAs>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib</AdditionalDependencies>
-      <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
-    </Link>
-    <ResourceCompile>
-      <AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
-    </ResourceCompile>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
       <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\IISLib;.\Inc;..\CommonLib</AdditionalIncludeDirectories>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <SDLCheck>true</SDLCheck>
-      <WholeProgramOptimization>true</WholeProgramOptimization>
-      <PreprocessKeepComments>false</PreprocessKeepComments>
-      <ExceptionHandling>SyncCThrow</ExceptionHandling>
-      <StructMemberAlignment>8Bytes</StructMemberAlignment>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <RuntimeTypeInfo>false</RuntimeTypeInfo>
-      <OmitDefaultLibName>true</OmitDefaultLibName>
-      <CompileAs>CompileAsCpp</CompileAs>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
     </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>false</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions)</AdditionalOptions>
-      <OptimizeReferences>true</OptimizeReferences>
-      <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
-      <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib</AdditionalDependencies>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
-    </Link>
-    <ResourceCompile>
-      <AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
-    </ResourceCompile>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' OR '$(Configuration)|$(Platform)'=='Release|ARM64' OR '$(Configuration)|$(Platform)'=='Release|Any CPU'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <AdditionalIncludeDirectories>..\IISLib;.\Inc;..\CommonLib</AdditionalIncludeDirectories>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <SDLCheck>true</SDLCheck>
-      <WholeProgramOptimization>true</WholeProgramOptimization>
-      <PreprocessKeepComments>false</PreprocessKeepComments>
-      <ExceptionHandling>SyncCThrow</ExceptionHandling>
-      <StructMemberAlignment>8Bytes</StructMemberAlignment>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <RuntimeTypeInfo>false</RuntimeTypeInfo>
-      <OmitDefaultLibName>true</OmitDefaultLibName>
-      <CompileAs>CompileAsCpp</CompileAs>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>false</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions)</AdditionalOptions>
-      <OptimizeReferences>true</OptimizeReferences>
-      <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
-      <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib</AdditionalDependencies>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
-    </Link>
-    <ResourceCompile>
-      <AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
-    </ResourceCompile>
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClInclude Include="ApplicationFactory.h" />
@@ -314,4 +111,4 @@
     </ItemGroup>
     <WriteLinesToFile File="$(InstallersOutputPath)aspnetcoremodule.version" Lines="@(VersionFileContents)" OverWrite="true" WriteOnlyWhenDifferent="True" />
   </Target>
-</Project>
+</Project>

+ 4 - 192
src/Servers/IIS/AspNetCoreModuleV2/CommonLib/CommonLib.vcxproj

@@ -1,202 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|ARM64">
-      <Configuration>Debug</Configuration>
-      <Platform>ARM64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Any CPU">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|ARM64">
-      <Configuration>Release</Configuration>
-      <Platform>ARM64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Any CPU">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
   <PropertyGroup Label="Globals">
-    <VCProjectVersion>15.0</VCProjectVersion>
     <ProjectGuid>{55494E58-E061-4C4C-A0A8-837008E72F85}</ProjectGuid>
-    <Keyword>Win32Proj</Keyword>
     <RootNamespace>NewCommon</RootNamespace>
-    <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
-    <PlatformToolsetVersion Condition=" '$(VisualStudioVersion)' == '17.0' ">v143</PlatformToolsetVersion>
-    <PlatformToolsetVersion Condition=" '$(PlatformToolsetVersion)' == '' ">v142</PlatformToolsetVersion>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Label="Configuration">
-    <VCToolsVersion />
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Debug|ARM64' OR '$(Configuration)|$(Platform)'=='Debug|Any CPU'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' OR '$(Configuration)|$(Platform)'=='Release|ARM64' OR '$(Configuration)|$(Platform)'=='Release|Any CPU'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <WholeProgramOptimization>false</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="Shared">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)'=='Debug'">
-    <LinkIncremental>true</LinkIncremental>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)'=='Release'">
-    <LinkIncremental>false</LinkIncremental>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <WarningLevel>Level4</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <Optimization>Disabled</Optimization>
-      <SDLCheck>false</SDLCheck>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <ConformanceMode>true</ConformanceMode>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <ShowIncludes>false</ShowIncludes>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Debug|ARM64' OR '$(Configuration)|$(Platform)'=='Debug|Any CPU'">
-    <ClCompile>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <WarningLevel>Level4</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <Optimization>Disabled</Optimization>
-      <SDLCheck>false</SDLCheck>
-      <PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <ConformanceMode>true</ConformanceMode>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <MinimalRebuild>false</MinimalRebuild>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <ShowIncludes>false</ShowIncludes>
-      <AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <WarningLevel>Level4</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <SDLCheck>false</SDLCheck>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <ConformanceMode>true</ConformanceMode>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <ShowIncludes>false</ShowIncludes>
-      <AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions)</AdditionalOptions>
-      <OptimizeReferences>true</OptimizeReferences>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' OR '$(Configuration)|$(Platform)'=='Release|ARM64' OR '$(Configuration)|$(Platform)'=='Release|Any CPU'">
+  <Import Project="..\..\build\Build.Lib.Settings" />
+  <ItemDefinitionGroup>
     <ClCompile>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <WarningLevel>Level4</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <SDLCheck>false</SDLCheck>
-      <PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <ConformanceMode>true</ConformanceMode>
-      <AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <AdditionalUsingDirectories>
-      </AdditionalUsingDirectories>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <ShowIncludes>false</ShowIncludes>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
+      <AdditionalIncludeDirectories>..\iislib;$(LibNetHostPath)</AdditionalIncludeDirectories>
     </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions)</AdditionalOptions>
-      <OptimizeReferences>true</OptimizeReferences>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
-    <Lib>
-      <AdditionalLibraryDirectories>..\iislib</AdditionalLibraryDirectories>
-    </Lib>
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClInclude Include="ErrorContext.h" />
@@ -279,4 +91,4 @@
   <Import Project="..\..\build\native.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>

+ 2 - 0
src/Servers/IIS/AspNetCoreModuleV2/CommonLib/GlobalVersionUtility.h

@@ -5,6 +5,8 @@
 
 #include "fx_ver.h"
 
+using namespace aspnet;
+
 class GlobalVersionUtility
 {
 public:

+ 79 - 75
src/Servers/IIS/AspNetCoreModuleV2/CommonLib/HostFxrResolver.cpp

@@ -12,6 +12,10 @@
 #include "StringHelpers.h"
 #include "RegistryKey.h"
 
+// This is needed to use libnethost as a static library
+#define NETHOST_USE_AS_STATIC
+#include <nethost.h>
+
 namespace fs = std::filesystem;
 
 void
@@ -41,7 +45,7 @@ HostFxrResolver::GetHostFxrParameters(
         // The only executable extension inprocess supports
         expandedProcessPath.replace_extension(".exe");
     }
-    else if (!ends_with(expandedProcessPath, L".exe", true))
+    else if (!endsWith(expandedProcessPath, L".exe", true))
     {
         throw InvalidOperationException(format(L"Process path '%s' doesn't have '.exe' extension.", expandedProcessPath.c_str()));
     }
@@ -56,12 +60,46 @@ HostFxrResolver::GetHostFxrParameters(
             throw InvalidOperationException(L"Application arguments are empty.");
         }
 
+        bool gotHostFxrPath = false;
         if (dotnetExePath.empty())
         {
-            dotnetExePath = GetAbsolutePathToDotnet(applicationPhysicalPath, expandedProcessPath);
+            // need to find dotnet for get_host_fxr_path when dotnet is launched from the path
+            if (!equals_ignore_case(expandedProcessPath, L"dotnet.exe"))
+            {
+                fs::path expandedProcessPathParent = expandedProcessPath.parent_path();
+                gotHostFxrPath = TryGetHostFxrPath(hostFxrDllPath, expandedProcessPathParent, applicationPhysicalPath);
+            }
+            else
+            {
+                LOG_INFOF(L"get_hostfxr_path skipped due to expandedProcessPath being dotnet.exe");
+            }
+
+            if (gotHostFxrPath)
+            {
+                dotnetExePath = GetAbsolutePathToDotnetFromHostfxr(hostFxrDllPath);
+            }
+            else
+            {
+                // Get the dotnet absolute path to use as dotnet_root
+                dotnetExePath = GetAbsolutePathToDotnet(applicationPhysicalPath, expandedProcessPath);
+            }
         }
 
-        hostFxrDllPath = GetAbsolutePathToHostFxr(dotnetExePath);
+        // We have dotnetExePath, get host fxr path using dotnet_root if we haven't gotten it yet
+        if (!gotHostFxrPath)
+        {
+            LOG_INFOF(L"Trying get_hostfxr_path with dotnet path as dotnet root");
+            fs::path dotnetExePathParent = dotnetExePath.parent_path();
+            gotHostFxrPath = TryGetHostFxrPath(hostFxrDllPath, dotnetExePathParent, applicationPhysicalPath);
+            if (!gotHostFxrPath)
+            {
+                throw InvalidOperationException(format(L"get_hostfxr_path failed"));
+            }
+        }
+
+        // we have dotnetExe path and get_hostfxr_path has succeeded
+        LOG_INFOF(L"dotnetExePath '%ls'", dotnetExePath.c_str());
+        LOG_INFOF(L"hostFxrDllpath '%ls'", hostFxrDllPath.c_str());
 
         arguments.push_back(dotnetExePath);
         AppendArguments(
@@ -121,7 +159,12 @@ HostFxrResolver::GetHostFxrParameters(
                 {
                     dotnetExePath = GetAbsolutePathToDotnet(applicationPhysicalPath, L"dotnet");
                 }
-                hostFxrDllPath = GetAbsolutePathToHostFxr(dotnetExePath);
+
+                fs::path dotnetExePathParent = dotnetExePath.parent_path();
+                if (!TryGetHostFxrPath(hostFxrDllPath, dotnetExePathParent, applicationPhysicalPath))
+                {
+                    throw InvalidOperationException(format(L"get_hostfxr_path failed"));
+                }
 
                 // For portable with launcher apps we need dotnet.exe to be argv[0] and .dll be argv[1]
                 arguments.push_back(dotnetExePath);
@@ -144,7 +187,35 @@ HostFxrResolver::GetHostFxrParameters(
     }
 }
 
-BOOL
+bool
+HostFxrResolver::TryGetHostFxrPath(
+    fs::path& hostFxrDllPath,
+    const fs::path& dotnetRoot,
+    const fs::path& applicationPath)
+{
+    std::wstring hostfxrPath;
+    size_t size = MAX_PATH * 2;
+    hostfxrPath.resize(size);
+
+    get_hostfxr_parameters params;
+    params.size = sizeof(get_hostfxr_parameters);
+    params.assembly_path = applicationPath.c_str();
+    params.dotnet_root = dotnetRoot.c_str();
+    LOG_INFOF(L"hostfxr.dotnet_root: '%ls'", params.dotnet_root);
+    LOG_INFOF(L"hostfxr.assembly_path: '%ls'", params.assembly_path);
+
+    int result = get_hostfxr_path(hostfxrPath.data(), &size, &params);
+    if (result != 0) {
+        LOG_INFOF(L"get_hostfxr_path failed (%x)", result);
+        return false;
+    }
+
+    hostfxrPath.resize(size);
+    hostFxrDllPath = hostfxrPath;
+    return true;
+}
+
+bool
 HostFxrResolver::IsDotnetExecutable(const std::filesystem::path& dotnetPath)
 {
     std::wstring filename = dotnetPath.filename().wstring();
@@ -202,7 +273,7 @@ HostFxrResolver::AppendArguments(
         std::wstring argument = pwzArgs[intArgsProcessed];
 
         // Try expanding arguments ending in .dll to a full paths
-        if (expandDllPaths && ends_with(argument, L".dll", true))
+        if (expandDllPaths && endsWith(argument, L".dll", true))
         {
             fs::path argumentAsPath = argument;
             if (argumentAsPath.is_relative())
@@ -313,37 +384,9 @@ HostFxrResolver::GetAbsolutePathToDotnet(
 }
 
 fs::path
-HostFxrResolver::GetAbsolutePathToHostFxr(
-    const fs::path & dotnetPath
-)
+HostFxrResolver::GetAbsolutePathToDotnetFromHostfxr(const fs::path& hostfxrPath)
 {
-    std::vector<std::wstring> versionFolders;
-    const auto hostFxrBase = dotnetPath.parent_path() / "host" / "fxr";
-
-    LOG_INFOF(L"Resolving absolute path to hostfxr.dll from '%ls'", dotnetPath.c_str());
-
-    if (!is_directory(hostFxrBase))
-    {
-        throw InvalidOperationException(format(L"Unable to find hostfxr directory at %s", hostFxrBase.c_str()));
-    }
-
-    FindDotNetFolders(hostFxrBase, versionFolders);
-
-    if (versionFolders.empty())
-    {
-        throw InvalidOperationException(format(L"Hostfxr directory '%s' doesn't contain any version subdirectories", hostFxrBase.c_str()));
-    }
-
-    const auto highestVersion = FindHighestDotNetVersion(versionFolders);
-    const auto hostFxrPath = hostFxrBase  / highestVersion / "hostfxr.dll";
-
-    if (!is_regular_file(hostFxrPath))
-    {
-        throw InvalidOperationException(format(L"hostfxr.dll not found at '%s'", hostFxrPath.c_str()));
-    }
-
-    LOG_INFOF(L"hostfxr.dll located at '%ls'", hostFxrPath.c_str());
-    return hostFxrPath;
+    return hostfxrPath.parent_path().parent_path().parent_path().parent_path() / "dotnet.exe";
 }
 
 //
@@ -502,42 +545,3 @@ HostFxrResolver::GetAbsolutePathToDotnetFromProgramFiles()
     const auto programFilesDotnet = fs::path(Environment::ExpandEnvironmentVariables(L"%ProgramFiles%")) / "dotnet" / "dotnet.exe";
     return is_regular_file(programFilesDotnet) ? std::make_optional(programFilesDotnet) : std::nullopt;
 }
-
-std::wstring
-HostFxrResolver::FindHighestDotNetVersion(
-    _In_ std::vector<std::wstring> & vFolders
-)
-{
-    fx_ver_t max_ver(-1, -1, -1);
-    for (const auto& dir : vFolders)
-    {
-        fx_ver_t fx_ver(-1, -1, -1);
-        if (fx_ver_t::parse(dir, &fx_ver, false))
-        {
-            max_ver = max(max_ver, fx_ver);
-        }
-    }
-
-    return max_ver.as_str();
-}
-
-VOID
-HostFxrResolver::FindDotNetFolders(
-    const std::filesystem::path &path,
-    _Out_ std::vector<std::wstring> &pvFolders
-)
-{
-    WIN32_FIND_DATAW data = {};
-    const auto searchPattern = std::wstring(path) + L"\\*";
-    HandleWrapper<FindFileHandleTraits> handle = FindFirstFileExW(searchPattern.c_str(), FindExInfoStandard, &data, FindExSearchNameMatch, nullptr, 0);
-    if (handle == INVALID_HANDLE_VALUE)
-    {
-        LOG_LAST_ERROR();
-        return;
-    }
-
-    do
-    {
-        pvFolders.emplace_back(data.cFileName);
-    } while (FindNextFileW(handle, &data));
-}

+ 8 - 13
src/Servers/IIS/AspNetCoreModuleV2/CommonLib/HostFxrResolver.h

@@ -44,28 +44,23 @@ public:
 private:
 
     static
-    BOOL
+    bool
     IsDotnetExecutable(
         const std::filesystem::path & dotnetPath
     );
 
     static
-    VOID
-    FindDotNetFolders(
-        const std::filesystem::path& path,
-        std::vector<std::wstring> & pvFolders
-    );
-
-    static
-    std::wstring
-    FindHighestDotNetVersion(
-        std::vector<std::wstring> & vFolders
+    bool
+    TryGetHostFxrPath(
+        std::filesystem::path& hostFxrDllPath,
+        const std::filesystem::path& dotnetRoot,
+        const std::filesystem::path& applicationPath
     );
 
     static
     std::filesystem::path
-    GetAbsolutePathToHostFxr(
-        const std::filesystem::path & dotnetPath
+    GetAbsolutePathToDotnetFromHostfxr(
+        const std::filesystem::path& hostfxrPath
     );
 
     static

+ 1 - 1
src/Servers/IIS/AspNetCoreModuleV2/CommonLib/StringHelpers.cpp

@@ -4,7 +4,7 @@
 #include "StringHelpers.h"
 #include "exceptions.h"
 
-bool ends_with(const std::wstring &source, const std::wstring &suffix, bool ignoreCase)
+bool endsWith(const std::wstring& source, const std::wstring& suffix, bool ignoreCase)
 {
     if (source.length() < suffix.length())
     {

+ 1 - 1
src/Servers/IIS/AspNetCoreModuleV2/CommonLib/StringHelpers.h

@@ -6,7 +6,7 @@
 #include <string>
 
 [[nodiscard]]
-bool ends_with(const std::wstring &source, const std::wstring &suffix, bool ignoreCase = false);
+bool endsWith(const std::wstring &source, const std::wstring &suffix, bool ignoreCase = false);
 
 [[nodiscard]]
 bool equals_ignore_case(const std::wstring& s1, const std::wstring& s2);

+ 308 - 305
src/Servers/IIS/AspNetCoreModuleV2/CommonLib/fx_ver.cpp

@@ -5,405 +5,408 @@
 #include <string>
 #include "fx_ver.h"
 
-static bool validIdentifiers(const std::wstring& ids);
-
-size_t index_of_non_numeric(const std::wstring& str, size_t i)
+namespace aspnet
 {
-    return str.find_first_not_of(TEXT("0123456789"), i);
-}
+    static bool validIdentifiers(const std::wstring& ids);
 
-bool try_stou(const std::wstring& str, unsigned* num)
-{
-    if (str.empty())
+    size_t index_of_non_numeric(const std::wstring& str, size_t i)
     {
-        return false;
+        return str.find_first_not_of(TEXT("0123456789"), i);
     }
-    if (index_of_non_numeric(str, 0) != std::wstring::npos)
+
+    bool try_stou(const std::wstring& str, unsigned* num)
     {
-        return false;
+        if (str.empty())
+        {
+            return false;
+        }
+        if (index_of_non_numeric(str, 0) != std::wstring::npos)
+        {
+            return false;
+        }
+        *num = (unsigned)std::stoul(str);
+        return true;
     }
-    *num = (unsigned)std::stoul(str);
-    return true;
-}
-
-fx_ver_t::fx_ver_t(int major, int minor, int patch, const std::wstring& pre, const std::wstring& build)
-    : m_major(major)
-    , m_minor(minor)
-    , m_patch(patch)
-    , m_pre(pre)
-    , m_build(build)
-{
-    // verify preconditions
-    assert(is_empty() || m_major >= 0);
-    assert(is_empty() || m_minor >= 0);
-    assert(is_empty() || m_patch >= 0);
-    assert(m_pre[0] == 0 || validIdentifiers(m_pre));
-    assert(m_build[0] == 0 || validIdentifiers(m_build));
-}
-
-fx_ver_t::fx_ver_t(int major, int minor, int patch, const std::wstring & pre)
-    : fx_ver_t(major, minor, patch, pre, TEXT(""))
-{
-}
-
-fx_ver_t::fx_ver_t(int major, int minor, int patch)
-    : fx_ver_t(major, minor, patch, TEXT(""), TEXT(""))
-{
-}
-
-fx_ver_t::fx_ver_t()
-    : fx_ver_t(-1, -1, -1, TEXT(""), TEXT(""))
-{
-}
-
-bool fx_ver_t::operator ==(const fx_ver_t & b) const
-{
-    return compare(*this, b) == 0;
-}
-
-bool fx_ver_t::operator !=(const fx_ver_t & b) const
-{
-    return !operator ==(b);
-}
-
-bool fx_ver_t::operator <(const fx_ver_t & b) const
-{
-    return compare(*this, b) < 0;
-}
 
-bool fx_ver_t::operator >(const fx_ver_t & b) const
-{
-    return compare(*this, b) > 0;
-}
+    fx_ver_t::fx_ver_t(int major, int minor, int patch, const std::wstring& pre, const std::wstring& build)
+        : m_major(major)
+        , m_minor(minor)
+        , m_patch(patch)
+        , m_pre(pre)
+        , m_build(build)
+    {
+        // verify preconditions
+        assert(is_empty() || m_major >= 0);
+        assert(is_empty() || m_minor >= 0);
+        assert(is_empty() || m_patch >= 0);
+        assert(m_pre[0] == 0 || validIdentifiers(m_pre));
+        assert(m_build[0] == 0 || validIdentifiers(m_build));
+    }
 
-bool fx_ver_t::operator <=(const fx_ver_t & b) const
-{
-    return compare(*this, b) <= 0;
-}
+    fx_ver_t::fx_ver_t(int major, int minor, int patch, const std::wstring& pre)
+        : fx_ver_t(major, minor, patch, pre, TEXT(""))
+    {
+    }
 
-bool fx_ver_t::operator >=(const fx_ver_t & b) const
-{
-    return compare(*this, b) >= 0;
-}
+    fx_ver_t::fx_ver_t(int major, int minor, int patch)
+        : fx_ver_t(major, minor, patch, TEXT(""), TEXT(""))
+    {
+    }
 
-std::wstring fx_ver_t::as_str() const
-{
-    std::wstringstream stream;
-    stream << m_major << TEXT(".") << m_minor << TEXT(".") << m_patch;
-    if (!m_pre.empty())
+    fx_ver_t::fx_ver_t()
+        : fx_ver_t(-1, -1, -1, TEXT(""), TEXT(""))
     {
-        stream << m_pre;
     }
-    if (!m_build.empty())
+
+    bool fx_ver_t::operator ==(const fx_ver_t& b) const
     {
-        stream << m_build;
+        return compare(*this, b) == 0;
     }
-    return stream.str();
-}
 
-std::wstring fx_ver_t::prerelease_glob() const
-{
-    std::wstringstream stream;
-    stream << m_major << TEXT(".") << m_minor << TEXT(".") << m_patch << TEXT("-*");
-    return stream.str();
-}
+    bool fx_ver_t::operator !=(const fx_ver_t& b) const
+    {
+        return !operator ==(b);
+    }
 
-std::wstring fx_ver_t::patch_glob() const
-{
-    std::wstringstream stream;
-    stream << m_major << TEXT(".") << m_minor << TEXT(".*");
-    return stream.str();
-}
+    bool fx_ver_t::operator <(const fx_ver_t& b) const
+    {
+        return compare(*this, b) < 0;
+    }
 
-static std::wstring getId(const std::wstring & ids, size_t idStart)
-{
-    size_t next = ids.find(TEXT('.'), idStart);
+    bool fx_ver_t::operator >(const fx_ver_t& b) const
+    {
+        return compare(*this, b) > 0;
+    }
 
-    return next == std::wstring::npos ? ids.substr(idStart) : ids.substr(idStart, next - idStart);
-}
+    bool fx_ver_t::operator <=(const fx_ver_t& b) const
+    {
+        return compare(*this, b) <= 0;
+    }
 
-/* static */
-int fx_ver_t::compare(const fx_ver_t & a, const fx_ver_t & b)
-{
-    // compare(u.v.w-p+b, x.y.z-q+c)
-    if (a.m_major != b.m_major)
+    bool fx_ver_t::operator >=(const fx_ver_t& b) const
     {
-        return (a.m_major > b.m_major) ? 1 : -1;
+        return compare(*this, b) >= 0;
     }
 
-    if (a.m_minor != b.m_minor)
+    std::wstring fx_ver_t::as_str() const
     {
-        return (a.m_minor > b.m_minor) ? 1 : -1;
+        std::wstringstream stream;
+        stream << m_major << TEXT(".") << m_minor << TEXT(".") << m_patch;
+        if (!m_pre.empty())
+        {
+            stream << m_pre;
+        }
+        if (!m_build.empty())
+        {
+            stream << m_build;
+        }
+        return stream.str();
     }
 
-    if (a.m_patch != b.m_patch)
+    std::wstring fx_ver_t::prerelease_glob() const
     {
-        return (a.m_patch > b.m_patch) ? 1 : -1;
+        std::wstringstream stream;
+        stream << m_major << TEXT(".") << m_minor << TEXT(".") << m_patch << TEXT("-*");
+        return stream.str();
     }
 
-    if (a.m_pre.empty() || b.m_pre.empty())
+    std::wstring fx_ver_t::patch_glob() const
     {
-        // Either a is empty or b is empty or both are empty
-        return a.m_pre.empty() ? !b.m_pre.empty() : -1;
+        std::wstringstream stream;
+        stream << m_major << TEXT(".") << m_minor << TEXT(".*");
+        return stream.str();
     }
 
-    // Both are non-empty (may be equal)
+    static std::wstring getId(const std::wstring& ids, size_t idStart)
+    {
+        size_t next = ids.find(TEXT('.'), idStart);
 
-    // First character of pre is '-' when it is not empty
-    assert(a.m_pre[0] == TEXT('-'));
-    assert(b.m_pre[0] == TEXT('-'));
+        return next == std::wstring::npos ? ids.substr(idStart) : ids.substr(idStart, next - idStart);
+    }
 
-    // First idenitifier starts at position 1
-    size_t idStart = 1;
-    for (size_t i = idStart; true; ++i)
+    /* static */
+    int fx_ver_t::compare(const fx_ver_t& a, const fx_ver_t& b)
     {
-        if (a.m_pre[i] != b.m_pre[i])
+        // compare(u.v.w-p+b, x.y.z-q+c)
+        if (a.m_major != b.m_major)
         {
-            // Found first character with a difference
-            if (a.m_pre[i] == 0 && b.m_pre[i] == TEXT('.'))
-            {
-                // identifiers both complete, b has an additional idenitifier
-                return -1;
-            }
-
-            if (b.m_pre[i] == 0 && a.m_pre[i] == TEXT('.'))
-            {
-                // identifiers both complete, a has an additional idenitifier
-                return 1;
-            }
+            return (a.m_major > b.m_major) ? 1 : -1;
+        }
 
-            // identifiers must not be empty
-            std::wstring ida = getId(a.m_pre, idStart);
-            std::wstring idb = getId(b.m_pre, idStart);
+        if (a.m_minor != b.m_minor)
+        {
+            return (a.m_minor > b.m_minor) ? 1 : -1;
+        }
 
-            unsigned idanum = 0;
-            bool idaIsNum = try_stou(ida, &idanum);
-            unsigned idbnum = 0;
-            bool idbIsNum = try_stou(idb, &idbnum);
+        if (a.m_patch != b.m_patch)
+        {
+            return (a.m_patch > b.m_patch) ? 1 : -1;
+        }
 
-            if (idaIsNum && idbIsNum)
-            {
-                // Numeric comparison
-                return (idanum > idbnum) ? 1 : -1;
-            }
-            else if (idaIsNum || idbIsNum)
-            {
-                // Mixed compare.  Spec: Number < Text
-                return idbIsNum ? 1 : -1;
-            }
-            // Ascii compare
-            return ida.compare(idb);
+        if (a.m_pre.empty() || b.m_pre.empty())
+        {
+            // Either a is empty or b is empty or both are empty
+            return a.m_pre.empty() ? !b.m_pre.empty() : -1;
         }
-        else
+
+        // Both are non-empty (may be equal)
+
+        // First character of pre is '-' when it is not empty
+        assert(a.m_pre[0] == TEXT('-'));
+        assert(b.m_pre[0] == TEXT('-'));
+
+        // First idenitifier starts at position 1
+        size_t idStart = 1;
+        for (size_t i = idStart; true; ++i)
         {
-            // a.m_pre[i] == b.m_pre[i]
-            if (a.m_pre[i] == 0)
+            if (a.m_pre[i] != b.m_pre[i])
             {
-                break;
+                // Found first character with a difference
+                if (a.m_pre[i] == 0 && b.m_pre[i] == TEXT('.'))
+                {
+                    // identifiers both complete, b has an additional idenitifier
+                    return -1;
+                }
+
+                if (b.m_pre[i] == 0 && a.m_pre[i] == TEXT('.'))
+                {
+                    // identifiers both complete, a has an additional idenitifier
+                    return 1;
+                }
+
+                // identifiers must not be empty
+                std::wstring ida = getId(a.m_pre, idStart);
+                std::wstring idb = getId(b.m_pre, idStart);
+
+                unsigned idanum = 0;
+                bool idaIsNum = try_stou(ida, &idanum);
+                unsigned idbnum = 0;
+                bool idbIsNum = try_stou(idb, &idbnum);
+
+                if (idaIsNum && idbIsNum)
+                {
+                    // Numeric comparison
+                    return (idanum > idbnum) ? 1 : -1;
+                }
+                else if (idaIsNum || idbIsNum)
+                {
+                    // Mixed compare.  Spec: Number < Text
+                    return idbIsNum ? 1 : -1;
+                }
+                // Ascii compare
+                return ida.compare(idb);
             }
-            if (a.m_pre[i] == TEXT('.'))
+            else
             {
-                idStart = i + 1;
+                // a.m_pre[i] == b.m_pre[i]
+                if (a.m_pre[i] == 0)
+                {
+                    break;
+                }
+                if (a.m_pre[i] == TEXT('.'))
+                {
+                    idStart = i + 1;
+                }
             }
         }
-    }
 
-    return 0;
-}
+        return 0;
+    }
 
-static bool validIdentifierCharSet(const std::wstring & id)
-{
-    // ids must be of the set [0-9a-zA-Z-]
+    static bool validIdentifierCharSet(const std::wstring& id)
+    {
+        // ids must be of the set [0-9a-zA-Z-]
 
-    // ASCII and Unicode ordering
-    static_assert(TEXT('-') < TEXT('0'), "Code assumes ordering - < 0 < 9 < A < Z < a < z");
-    static_assert(TEXT('0') < TEXT('9'), "Code assumes ordering - < 0 < 9 < A < Z < a < z");
-    static_assert(TEXT('9') < TEXT('A'), "Code assumes ordering - < 0 < 9 < A < Z < a < z");
-    static_assert(TEXT('A') < TEXT('Z'), "Code assumes ordering - < 0 < 9 < A < Z < a < z");
-    static_assert(TEXT('Z') < TEXT('a'), "Code assumes ordering - < 0 < 9 < A < Z < a < z");
-    static_assert(TEXT('a') < TEXT('z'), "Code assumes ordering - < 0 < 9 < A < Z < a < z");
+        // ASCII and Unicode ordering
+        static_assert(TEXT('-') < TEXT('0'), "Code assumes ordering - < 0 < 9 < A < Z < a < z");
+        static_assert(TEXT('0') < TEXT('9'), "Code assumes ordering - < 0 < 9 < A < Z < a < z");
+        static_assert(TEXT('9') < TEXT('A'), "Code assumes ordering - < 0 < 9 < A < Z < a < z");
+        static_assert(TEXT('A') < TEXT('Z'), "Code assumes ordering - < 0 < 9 < A < Z < a < z");
+        static_assert(TEXT('Z') < TEXT('a'), "Code assumes ordering - < 0 < 9 < A < Z < a < z");
+        static_assert(TEXT('a') < TEXT('z'), "Code assumes ordering - < 0 < 9 < A < Z < a < z");
 
-    for (size_t i = 0; id[i] != 0; ++i)
-    {
-        if (id[i] >= TEXT('A'))
+        for (size_t i = 0; id[i] != 0; ++i)
         {
-            if ((id[i] > TEXT('Z') && id[i] < TEXT('a')) || id[i] > TEXT('z'))
+            if (id[i] >= TEXT('A'))
             {
-                return false;
+                if ((id[i] > TEXT('Z') && id[i] < TEXT('a')) || id[i] > TEXT('z'))
+                {
+                    return false;
+                }
             }
-        }
-        else
-        {
-            if ((id[i] < TEXT('0') && id[i] != TEXT('-')) || id[i] > TEXT('9'))
+            else
             {
-                return false;
+                if ((id[i] < TEXT('0') && id[i] != TEXT('-')) || id[i] > TEXT('9'))
+                {
+                    return false;
+                }
             }
         }
-    }
-    return true;
-}
-
-static bool validIdentifier(const std::wstring & id, bool buildMeta)
-{
-    if (id.empty())
-    {
-        // Identifier must not be empty
-        return false;
+        return true;
     }
 
-    if (!validIdentifierCharSet(id))
+    static bool validIdentifier(const std::wstring& id, bool buildMeta)
     {
-        // ids must be of the set [0-9a-zA-Z-]
-        return false;
-    }
+        if (id.empty())
+        {
+            // Identifier must not be empty
+            return false;
+        }
 
-    if (!buildMeta && id[0] == TEXT('0') && id[1] != 0 && index_of_non_numeric(id, 1) == std::wstring::npos)
-    {
-        // numeric identifiers must not be padded with 0s
-        return false;
-    }
-    return true;
-}
+        if (!validIdentifierCharSet(id))
+        {
+            // ids must be of the set [0-9a-zA-Z-]
+            return false;
+        }
 
-static bool validIdentifiers(const std::wstring & ids)
-{
-    if (ids.empty())
-    {
+        if (!buildMeta && id[0] == TEXT('0') && id[1] != 0 && index_of_non_numeric(id, 1) == std::wstring::npos)
+        {
+            // numeric identifiers must not be padded with 0s
+            return false;
+        }
         return true;
     }
 
-    bool prerelease = ids[0] == TEXT('-');
-    bool buildMeta = ids[0] == TEXT('+');
-
-    if (!(prerelease || buildMeta))
+    static bool validIdentifiers(const std::wstring& ids)
     {
-        // ids must start with '-' or '+' for prerelease & build respectively
-        return false;
-    }
+        if (ids.empty())
+        {
+            return true;
+        }
 
-    size_t idStart = 1;
-    size_t nextId;
-    while ((nextId = ids.find(TEXT('.'), idStart)) != std::wstring::npos)
-    {
-        if (!validIdentifier(ids.substr(idStart, nextId - idStart), buildMeta))
+        bool prerelease = ids[0] == TEXT('-');
+        bool buildMeta = ids[0] == TEXT('+');
+
+        if (!(prerelease || buildMeta))
         {
+            // ids must start with '-' or '+' for prerelease & build respectively
             return false;
         }
-        idStart = nextId + 1;
-    }
 
-    if (!validIdentifier(ids.substr(idStart), buildMeta))
-    {
-        return false;
-    }
+        size_t idStart = 1;
+        size_t nextId;
+        while ((nextId = ids.find(TEXT('.'), idStart)) != std::wstring::npos)
+        {
+            if (!validIdentifier(ids.substr(idStart, nextId - idStart), buildMeta))
+            {
+                return false;
+            }
+            idStart = nextId + 1;
+        }
 
-    return true;
-}
+        if (!validIdentifier(ids.substr(idStart), buildMeta))
+        {
+            return false;
+        }
 
-bool parse_internal(const std::wstring & ver, fx_ver_t * fx_ver, bool parse_only_production)
-{
-    size_t maj_start = 0;
-    size_t maj_sep = ver.find(TEXT('.'));
-    if (maj_sep == std::wstring::npos)
-    {
-        return false;
-    }
-    unsigned major = 0;
-    if (!try_stou(ver.substr(maj_start, maj_sep), &major))
-    {
-        return false;
-    }
-    if (maj_sep > 1 && ver[maj_start] == TEXT('0'))
-    {
-        // if leading character is 0, and strlen > 1
-        // then the numeric substring has leading zeroes which is prohibited by the specification.
-        return false;
+        return true;
     }
 
-    size_t min_start = maj_sep + 1;
-    size_t min_sep = ver.find(TEXT('.'), min_start);
-    if (min_sep == std::wstring::npos)
+    bool parse_internal(const std::wstring& ver, fx_ver_t* fx_ver, bool parse_only_production)
     {
-        return false;
-    }
+        size_t maj_start = 0;
+        size_t maj_sep = ver.find(TEXT('.'));
+        if (maj_sep == std::wstring::npos)
+        {
+            return false;
+        }
+        unsigned major = 0;
+        if (!try_stou(ver.substr(maj_start, maj_sep), &major))
+        {
+            return false;
+        }
+        if (maj_sep > 1 && ver[maj_start] == TEXT('0'))
+        {
+            // if leading character is 0, and strlen > 1
+            // then the numeric substring has leading zeroes which is prohibited by the specification.
+            return false;
+        }
 
-    unsigned minor = 0;
-    if (!try_stou(ver.substr(min_start, min_sep - min_start), &minor))
-    {
-        return false;
-    }
-    if (min_sep - min_start > 1 && ver[min_start] == TEXT('0'))
-    {
-        // if leading character is 0, and strlen > 1
-        // then the numeric substring has leading zeroes which is prohibited by the specification.
-        return false;
-    }
+        size_t min_start = maj_sep + 1;
+        size_t min_sep = ver.find(TEXT('.'), min_start);
+        if (min_sep == std::wstring::npos)
+        {
+            return false;
+        }
 
-    unsigned patch = 0;
-    size_t pat_start = min_sep + 1;
-    size_t pat_sep = index_of_non_numeric(ver, pat_start);
-    if (pat_sep == std::wstring::npos)
-    {
-        if (!try_stou(ver.substr(pat_start), &patch))
+        unsigned minor = 0;
+        if (!try_stou(ver.substr(min_start, min_sep - min_start), &minor))
         {
             return false;
         }
-        if (ver[pat_start + 1] != 0 && ver[pat_start] == TEXT('0'))
+        if (min_sep - min_start > 1 && ver[min_start] == TEXT('0'))
         {
-            // if leading character is 0, and strlen != 1
+            // if leading character is 0, and strlen > 1
             // then the numeric substring has leading zeroes which is prohibited by the specification.
             return false;
         }
 
-        *fx_ver = fx_ver_t(major, minor, patch);
-        return true;
-    }
+        unsigned patch = 0;
+        size_t pat_start = min_sep + 1;
+        size_t pat_sep = index_of_non_numeric(ver, pat_start);
+        if (pat_sep == std::wstring::npos)
+        {
+            if (!try_stou(ver.substr(pat_start), &patch))
+            {
+                return false;
+            }
+            if (ver[pat_start + 1] != 0 && ver[pat_start] == TEXT('0'))
+            {
+                // if leading character is 0, and strlen != 1
+                // then the numeric substring has leading zeroes which is prohibited by the specification.
+                return false;
+            }
 
-    if (parse_only_production)
-    {
-        // This is a prerelease or has build suffix.
-        return false;
-    }
+            *fx_ver = fx_ver_t(major, minor, patch);
+            return true;
+        }
 
-    if (!try_stou(ver.substr(pat_start, pat_sep - pat_start), &patch))
-    {
-        return false;
-    }
-    if (pat_sep - pat_start > 1 && ver[pat_start] == TEXT('0'))
-    {
-        return false;
-    }
+        if (parse_only_production)
+        {
+            // This is a prerelease or has build suffix.
+            return false;
+        }
 
-    size_t pre_start = pat_sep;
-    size_t pre_sep = ver.find(TEXT('+'), pat_sep);
+        if (!try_stou(ver.substr(pat_start, pat_sep - pat_start), &patch))
+        {
+            return false;
+        }
+        if (pat_sep - pat_start > 1 && ver[pat_start] == TEXT('0'))
+        {
+            return false;
+        }
 
-    std::wstring pre = (pre_sep == std::wstring::npos) ? ver.substr(pre_start) : ver.substr(pre_start, pre_sep - pre_start);
+        size_t pre_start = pat_sep;
+        size_t pre_sep = ver.find(TEXT('+'), pat_sep);
 
-    if (!validIdentifiers(pre))
-    {
-        return false;
-    }
+        std::wstring pre = (pre_sep == std::wstring::npos) ? ver.substr(pre_start) : ver.substr(pre_start, pre_sep - pre_start);
 
-    std::wstring build;
+        if (!validIdentifiers(pre))
+        {
+            return false;
+        }
 
-    if (pre_sep != std::wstring::npos)
-    {
-        build = ver.substr(pre_sep);
+        std::wstring build;
 
-        if (!validIdentifiers(build))
+        if (pre_sep != std::wstring::npos)
         {
-            return false;
+            build = ver.substr(pre_sep);
+
+            if (!validIdentifiers(build))
+            {
+                return false;
+            }
         }
-    }
 
-    *fx_ver = fx_ver_t(major, minor, patch, pre, build);
-    return true;
-}
+        *fx_ver = fx_ver_t(major, minor, patch, pre, build);
+        return true;
+    }
 
-/* static */
-bool fx_ver_t::parse(const std::wstring & ver, fx_ver_t * fx_ver, bool parse_only_production)
-{
-    bool valid = parse_internal(ver, fx_ver, parse_only_production);
-    assert(!valid || fx_ver->as_str() == ver);
-    return valid;
+    /* static */
+    bool fx_ver_t::parse(const std::wstring& ver, fx_ver_t* fx_ver, bool parse_only_production)
+    {
+        bool valid = parse_internal(ver, fx_ver, parse_only_production);
+        assert(!valid || fx_ver->as_str() == ver);
+        return valid;
+    }
 }

+ 47 - 45
src/Servers/IIS/AspNetCoreModuleV2/CommonLib/fx_ver.h

@@ -6,50 +6,52 @@
 
 #include <string>
 
-// Note: This is intended to implement SemVer 2.0
-struct fx_ver_t
+namespace aspnet
 {
-    fx_ver_t();
-    fx_ver_t(int major, int minor, int patch);
-    // if not empty pre contains valid prerelease label with leading '-'
-    fx_ver_t(int major, int minor, int patch, const std::wstring& pre);
-    // if not empty pre contains valid prerelease label with leading '-'
-    // if not empty build contains valid build label with leading '+'
-    fx_ver_t(int major, int minor, int patch, const std::wstring& pre, const std::wstring& build);
-
-    int get_major() const { return m_major; }
-    int get_minor() const { return m_minor; }
-    int get_patch() const { return m_patch; }
-
-    void set_major(int m) { m_major = m; }
-    void set_minor(int m) { m_minor = m; }
-    void set_patch(int p) { m_patch = p; }
-
-    bool is_prerelease() const { return !m_pre.empty(); }
-
-    bool is_empty() const { return m_major == -1; }
-
-    std::wstring as_str() const;
-    std::wstring prerelease_glob() const;
-    std::wstring patch_glob() const;
-
-    bool operator ==(const fx_ver_t& b) const;
-    bool operator !=(const fx_ver_t& b) const;
-    bool operator <(const fx_ver_t& b) const;
-    bool operator >(const fx_ver_t& b) const;
-    bool operator <=(const fx_ver_t& b) const;
-    bool operator >=(const fx_ver_t& b) const;
-
-    static bool parse(const std::wstring& ver, fx_ver_t* fx_ver, bool parse_only_production = false);
-
-private:
-    int m_major;
-    int m_minor;
-    int m_patch;
-    std::wstring m_pre;
-    std::wstring m_build;
-
-    static int compare(const fx_ver_t& a, const fx_ver_t& b);
-};
-
+    // Note: This is intended to implement SemVer 2.0
+    struct fx_ver_t
+    {
+        fx_ver_t();
+        fx_ver_t(int major, int minor, int patch);
+        // if not empty pre contains valid prerelease label with leading '-'
+        fx_ver_t(int major, int minor, int patch, const std::wstring& pre);
+        // if not empty pre contains valid prerelease label with leading '-'
+        // if not empty build contains valid build label with leading '+'
+        fx_ver_t(int major, int minor, int patch, const std::wstring& pre, const std::wstring& build);
+
+        int get_major() const { return m_major; }
+        int get_minor() const { return m_minor; }
+        int get_patch() const { return m_patch; }
+
+        void set_major(int m) { m_major = m; }
+        void set_minor(int m) { m_minor = m; }
+        void set_patch(int p) { m_patch = p; }
+
+        bool is_prerelease() const { return !m_pre.empty(); }
+
+        bool is_empty() const { return m_major == -1; }
+
+        std::wstring as_str() const;
+        std::wstring prerelease_glob() const;
+        std::wstring patch_glob() const;
+
+        bool operator ==(const fx_ver_t& b) const;
+        bool operator !=(const fx_ver_t& b) const;
+        bool operator <(const fx_ver_t& b) const;
+        bool operator >(const fx_ver_t& b) const;
+        bool operator <=(const fx_ver_t& b) const;
+        bool operator >=(const fx_ver_t& b) const;
+
+        static bool parse(const std::wstring& ver, fx_ver_t* fx_ver, bool parse_only_production = false);
+
+    private:
+        int m_major;
+        int m_minor;
+        int m_patch;
+        std::wstring m_pre;
+        std::wstring m_build;
+
+        static int compare(const fx_ver_t& a, const fx_ver_t& b);
+    };
+}
 #endif // __FX_VER_H__

+ 0 - 67
src/Servers/IIS/AspNetCoreModuleV2/CommonLib/hostfxroptions.cpp

@@ -1,67 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-#include "hostfxroptions.h"
-
-#include "hostfxr_utility.h"
-#include "debugutil.h"
-#include "exceptions.h"
-#include "EventLog.h"
-
-HRESULT HOSTFXR_OPTIONS::Create(
-        _In_ const std::wstring& pcwzDotnetExePath,
-        _In_ const std::wstring& pcwzProcessPath,
-        _In_ const std::wstring& pcwzApplicationPhysicalPath,
-        _In_ const std::wstring& pcwzArguments,
-        _Out_ std::unique_ptr<HOSTFXR_OPTIONS>& ppWrapper)
-{
-    std::filesystem::path knownDotnetLocation;
-
-    if (!pcwzDotnetExePath.empty())
-    {
-        knownDotnetLocation = pcwzDotnetExePath;
-    }
-
-    try
-    {
-        std::filesystem::path hostFxrDllPath;
-        std::vector<std::wstring> arguments;
-        HOSTFXR_UTILITY::GetHostFxrParameters(
-                pcwzProcessPath,
-                pcwzApplicationPhysicalPath,
-                pcwzArguments,
-                hostFxrDllPath,
-                knownDotnetLocation,
-                arguments);
-
-        LOG_INFOF(L"Parsed hostfxr options: dotnet location: '%ls' hostfxr path: '%ls' arguments:", knownDotnetLocation.c_str(), hostFxrDllPath.c_str());
-        for (size_t i = 0; i < arguments.size(); i++)
-        {
-            LOG_INFOF(L"Argument[%d] = '%ls'", i, arguments[i].c_str());
-        }
-        ppWrapper = std::make_unique<HOSTFXR_OPTIONS>(knownDotnetLocation, hostFxrDllPath, arguments);
-    }
-    catch (InvalidOperationException &ex)
-    {
-        EventLog::Error(
-            ASPNETCORE_EVENT_INPROCESS_START_ERROR,
-            ASPNETCORE_EVENT_INPROCESS_START_ERROR_MSG,
-            pcwzApplicationPhysicalPath.c_str(),
-            ex.as_wstring().c_str());
-
-        RETURN_CAUGHT_EXCEPTION();
-    }
-    catch (std::runtime_error &ex)
-    {
-        EventLog::Error(
-            ASPNETCORE_EVENT_INPROCESS_START_ERROR,
-            ASPNETCORE_EVENT_INPROCESS_START_ERROR_MSG,
-            pcwzApplicationPhysicalPath.c_str(),
-            GetUnexpectedExceptionMessage(ex).c_str());
-
-        RETURN_CAUGHT_EXCEPTION();
-    }
-    CATCH_RETURN();
-
-    return S_OK;
-}

+ 0 - 61
src/Servers/IIS/AspNetCoreModuleV2/CommonLib/hostfxroptions.h

@@ -1,61 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-#pragma once
-
-#include <Windows.h>
-#include <memory>
-#include <filesystem>
-#include <utility>
-#include <vector>
-#include <string>
-
-class HOSTFXR_OPTIONS
-{
-public:
-    HOSTFXR_OPTIONS(
-        std::filesystem::path dotnetExeLocation,
-        std::filesystem::path hostFxrLocation,
-        std::vector<std::wstring> arguments
-        ) noexcept
-    :   m_dotnetExeLocation(std::move(dotnetExeLocation)),
-        m_hostFxrLocation(std::move(hostFxrLocation)),
-        m_arguments(std::move(arguments))
-    {}
-
-    void
-    GetArguments(DWORD &hostfxrArgc, std::unique_ptr<PCWSTR[]> &hostfxrArgv) const
-    {
-        hostfxrArgc = static_cast<DWORD>(m_arguments.size());
-        hostfxrArgv = std::make_unique<PCWSTR[]>(hostfxrArgc);
-        for (DWORD i = 0; i < hostfxrArgc; ++i)
-        {
-            hostfxrArgv[i] = m_arguments[i].c_str();
-        }
-    }
-
-    const std::filesystem::path&
-    GetHostFxrLocation() const noexcept
-    {
-        return m_hostFxrLocation;
-    }
-
-    const std::filesystem::path&
-    GetDotnetExeLocation() const noexcept
-    {
-        return m_dotnetExeLocation;
-    }
-
-    static
-    HRESULT Create(
-         _In_  const std::wstring& pcwzExeLocation,
-         _In_  const std::wstring& pcwzProcessPath,
-         _In_  const std::wstring& pcwzApplicationPhysicalPath,
-         _In_  const std::wstring& pcwzArguments,
-         _Out_ std::unique_ptr<HOSTFXR_OPTIONS>& ppWrapper);
-
-private:
-    const std::filesystem::path m_dotnetExeLocation;
-    const std::filesystem::path m_hostFxrLocation;
-    const std::vector<std::wstring> m_arguments;
-};

+ 15 - 155
src/Servers/IIS/AspNetCoreModuleV2/CommonLibTests/CommonLibTests.vcxproj

@@ -2,7 +2,8 @@
   <PropertyGroup>
     <BuildHelixPayload>false</BuildHelixPayload>
   </PropertyGroup>
-  <ItemGroup Label="ProjectConfigurations">
+
+ <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
       <Configuration>Debug</Configuration>
       <Platform>Win32</Platform>
@@ -40,7 +41,6 @@
     <ProjectGuid>{1eac8125-1765-4e2d-8cbe-56dc98a1c8c1}</ProjectGuid>
     <Keyword>Win32Proj</Keyword>
     <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
-    <PlatformToolsetVersion Condition=" '$(VisualStudioVersion)' == '17.0' ">v143</PlatformToolsetVersion>
     <PlatformToolsetVersion Condition=" '$(PlatformToolsetVersion)' == '' ">v142</PlatformToolsetVersion>
     <ConfigurationType>Application</ConfigurationType>
     <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
@@ -50,7 +50,7 @@
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Label="Configuration">
-    <VCToolsVersion />
+    <VCToolsVersion>14.29.30133</VCToolsVersion>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings" />
@@ -104,180 +104,40 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
   </ItemGroup>
-  <ItemDefinitionGroup />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+  <ItemDefinitionGroup>
     <ClCompile>
       <PrecompiledHeader>NotUsing</PrecompiledHeader>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <!-- Without a debug version of libnethost.lib we cannot use _DEBUG -->
+      <PreprocessorDefinitions>;NDEBUG;_CONSOLE;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Platform)'=='x64' OR '$(Platform)'=='ARM64'">_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Platform)'=='Win32'">WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
       <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\RequestHandlerLib;..\IISLib;..\CommonLib;$(GoogleTestSubmoduleRoot)googletest\include;$(GoogleTestSubmoduleRoot)googlemock\include;...\AspNetCore\Inc;..\InProcessRequestHandler\</AdditionalIncludeDirectories>
-      <AdditionalOptions>/D "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" </AdditionalOptions>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Console</SubSystem>
-      <AdditionalLibraryDirectories>$(ArtifactsObjDir)InProcessRequestHandler\Win32\$(Configuration)\;</AdditionalLibraryDirectories>
-      <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;Rpcrt4.lib;inprocessapplicationbase.obj;stdafx.obj;version.lib;inprocessoptions.obj;%(AdditionalDependencies)</AdditionalDependencies>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
-    </Link>
-    <Lib>
-      <AdditionalDependencies>
-      </AdditionalDependencies>
-    </Lib>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Debug|Any CPU'">
-    <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>X64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\RequestHandlerLib;..\IISLib;..\CommonLib;$(GoogleTestSubmoduleRoot)googletest\include;$(GoogleTestSubmoduleRoot)googlemock\include;...\AspNetCore\Inc;..\InProcessRequestHandler\</AdditionalIncludeDirectories>
-      <AdditionalOptions>/D "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" </AdditionalOptions>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Console</SubSystem>
-      <AdditionalLibraryDirectories>$(ArtifactsObjDir)InProcessRequestHandler\x64\$(Configuration)\;</AdditionalLibraryDirectories>
-      <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;Rpcrt4.lib;inprocessapplicationbase.obj;stdafx.obj;version.lib;inprocessoptions.obj;%(AdditionalDependencies)</AdditionalDependencies>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
-    </Link>
-    <Lib>
-      <AdditionalDependencies>
-      </AdditionalDependencies>
-    </Lib>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
-    <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>X64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\RequestHandlerLib;..\IISLib;..\CommonLib;$(GoogleTestSubmoduleRoot)googletest\include;$(GoogleTestSubmoduleRoot)googlemock\include;...\AspNetCore\Inc;..\InProcessRequestHandler\</AdditionalIncludeDirectories>
-      <AdditionalOptions>/D "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" </AdditionalOptions>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Console</SubSystem>
-      <AdditionalLibraryDirectories>$(ArtifactsObjDir)InProcessRequestHandler\ARM64\$(Configuration)\;</AdditionalLibraryDirectories>
-      <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;Rpcrt4.lib;inprocessapplicationbase.obj;stdafx.obj;version.lib;inprocessoptions.obj;%(AdditionalDependencies)</AdditionalDependencies>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
-    </Link>
-    <Lib>
-      <AdditionalDependencies>
-      </AdditionalDependencies>
-    </Lib>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
       <TreatWarningAsError>true</TreatWarningAsError>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\RequestHandlerLib;..\IISLib;..\CommonLib;$(GoogleTestSubmoduleRoot)googletest\include;$(GoogleTestSubmoduleRoot)googlemock\include;...\AspNetCore\Inc;..\InProcessRequestHandler\</AdditionalIncludeDirectories>
       <AdditionalOptions>/D "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" </AdditionalOptions>
       <LanguageStandard>stdcpp17</LanguageStandard>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
     </ClCompile>
     <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Console</SubSystem>
-      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions)</AdditionalOptions>
-      <OptimizeReferences>true</OptimizeReferences>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalLibraryDirectories>$(ArtifactsObjDir)InProcessRequestHandler\Win32\$(Configuration)\;</AdditionalLibraryDirectories>
-      <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;Rpcrt4.lib;inprocessapplicationbase.obj;stdafx.obj;version.lib;inprocessoptions.obj;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib /ignore:4099 %(AdditionalOptions)</AdditionalOptions>
+      <AdditionalLibraryDirectories>$(ArtifactsObjDir)InProcessRequestHandler\$(Platform)\$(Configuration)\;$(LibNetHostPath)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;Rpcrt4.lib;inprocessapplicationbase.obj;stdafx.obj;version.lib;inprocessoptions.obj;$(LibNetHostPath)\libnethost.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
     </Link>
-    <Lib>
-      <AdditionalDependencies>
-      </AdditionalDependencies>
-    </Lib>
   </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' OR '$(Configuration)|$(Platform)'=='Release|Any CPU'">
-    <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <PreprocessorDefinitions>X64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\RequestHandlerLib;..\IISLib;..\CommonLib;$(GoogleTestSubmoduleRoot)googletest\include;$(GoogleTestSubmoduleRoot)googlemock\include;...\AspNetCore\Inc;..\InProcessRequestHandler\</AdditionalIncludeDirectories>
-      <AdditionalOptions>/D "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" </AdditionalOptions>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-    </ClCompile>
+  <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
     <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Console</SubSystem>
-      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions)</AdditionalOptions>
       <OptimizeReferences>true</OptimizeReferences>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalLibraryDirectories>$(ArtifactsObjDir)InProcessRequestHandler\x64\$(Configuration)\;</AdditionalLibraryDirectories>
-      <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;Rpcrt4.lib;inprocessapplicationbase.obj;stdafx.obj;version.lib;inprocessoptions.obj;%(AdditionalDependencies)</AdditionalDependencies>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
-    </Link>
-    <Lib>
-      <AdditionalDependencies>
-      </AdditionalDependencies>
-    </Lib>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
-    <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <PreprocessorDefinitions>X64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <WarningLevel>Level3</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories);..\RequestHandlerLib;..\IISLib;..\CommonLib;$(GoogleTestSubmoduleRoot)googletest\include;$(GoogleTestSubmoduleRoot)googlemock\include;...\AspNetCore\Inc;..\InProcessRequestHandler\</AdditionalIncludeDirectories>
-      <AdditionalOptions>/D "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" </AdditionalOptions>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Console</SubSystem>
-      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions)</AdditionalOptions>
-      <OptimizeReferences>true</OptimizeReferences>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalLibraryDirectories>$(ArtifactsObjDir)InProcessRequestHandler\ARM64\$(Configuration)\;</AdditionalLibraryDirectories>
-      <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;inprocessapplication.obj;inprocesshandler.obj;ahadmin.lib;Rpcrt4.lib;inprocessapplicationbase.obj;stdafx.obj;version.lib;inprocessoptions.obj;%(AdditionalDependencies)</AdditionalDependencies>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
     </Link>
-    <Lib>
-      <AdditionalDependencies>
-      </AdditionalDependencies>
-    </Lib>
   </ItemDefinitionGroup>
-</Project>
+
+
+</Project>

+ 1 - 1
src/Servers/IIS/AspNetCoreModuleV2/CommonLibTests/dotnet_exe_path_tests.cpp

@@ -34,7 +34,7 @@ namespace InprocessTests
             arguments,
             errorContext);
 
-        ASSERT_TRUE(ends_with(arguments[0], L"\\Fake\\hello-dotnet.exe", true));
+        ASSERT_TRUE(endsWith(arguments[0], L"\\Fake\\hello-dotnet.exe", true));
         ASSERT_STREQ(arguments[1].c_str(), L"-a");
         ASSERT_STREQ(arguments[2].c_str(), L"--tag");
         ASSERT_STREQ(arguments[3].c_str(), L"t");

+ 6 - 8
src/Servers/IIS/AspNetCoreModuleV2/IISLib/IISLib.vcxproj

@@ -40,22 +40,20 @@
     <RootNamespace>IISLib</RootNamespace>
     <ProjectName>IISLib</ProjectName>
     <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
-    <PlatformToolsetVersion Condition=" '$(VisualStudioVersion)' == '17.0' ">v143</PlatformToolsetVersion>
-    <PlatformToolsetVersion Condition=" '$(PlatformToolsetVersion)' == '' ">v142</PlatformToolsetVersion>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Label="Configuration">
-    <VCToolsVersion />
+    <VCToolsVersion>14.29.30133</VCToolsVersion>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
+    <UseDebugLibraries>false</UseDebugLibraries>
     <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Debug|ARM64' OR '$(Configuration)|$(Platform)'=='Debug|Any CPU'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
+    <UseDebugLibraries>false</UseDebugLibraries>
     <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
@@ -86,10 +84,10 @@
       </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <SDLCheck>true</SDLCheck>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
       <ShowIncludes>false</ShowIncludes>
       <TreatWarningAsError>true</TreatWarningAsError>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
@@ -161,4 +159,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>

+ 4 - 215
src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/InProcessRequestHandler.vcxproj

@@ -1,235 +1,24 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\..\build\Build.Settings" />
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|ARM64">
-      <Configuration>Debug</Configuration>
-      <Platform>ARM64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Any CPU">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|ARM64">
-      <Configuration>Release</Configuration>
-      <Platform>ARM64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Any CPU">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
   <PropertyGroup Label="Globals">
-    <VCProjectVersion>15.0</VCProjectVersion>
     <ProjectGuid>{D57EA297-6DC2-4BC0-8C91-334863327863}</ProjectGuid>
-    <Keyword>Win32Proj</Keyword>
     <RootNamespace>InProcessRequestHandler</RootNamespace>
-    <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
-    <PlatformToolsetVersion Condition=" '$(VisualStudioVersion)' == '17.0' ">v143</PlatformToolsetVersion>
-    <PlatformToolsetVersion Condition=" '$(PlatformToolsetVersion)' == '' ">v142</PlatformToolsetVersion>
     <ProjectName>InProcessRequestHandler</ProjectName>
   </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Label="Configuration">
-    <VCToolsVersion />
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Debug|ARM64' OR '$(Configuration)|$(Platform)'=='Debug|Any CPU'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' OR '$(Configuration)|$(Platform)'=='Release|ARM64' OR '$(Configuration)|$(Platform)'=='Release|Any CPU'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="Shared">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
+  <Import Project="..\..\build\Build.Dll.Settings" />
   <PropertyGroup>
     <TargetName>aspnetcorev2_inprocess</TargetName>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)'=='Debug'">
-    <LinkIncremental>false</LinkIncremental>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;REQUESTHANDLER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <AdditionalIncludeDirectories>..\IISLib;..\CommonLib;.\Inc;..\RequestHandlerLib</AdditionalIncludeDirectories>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <SDLCheck>true</SDLCheck>
-      <WholeProgramOptimization>true</WholeProgramOptimization>
-      <PreprocessKeepComments>false</PreprocessKeepComments>
-      <ExceptionHandling>SyncCThrow</ExceptionHandling>
-      <StructMemberAlignment>8Bytes</StructMemberAlignment>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <RuntimeTypeInfo>false</RuntimeTypeInfo>
-      <OmitDefaultLibName>true</OmitDefaultLibName>
-      <CompileAs>CompileAsCpp</CompileAs>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib</AdditionalDependencies>
-      <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Debug|ARM64' OR '$(Configuration)|$(Platform)'=='Debug|Any CPU'">
-    <ClCompile>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;REQUESTHANDLER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <AdditionalIncludeDirectories>..\IISLib;..\CommonLib;.\Inc;..\RequestHandlerLib</AdditionalIncludeDirectories>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <SDLCheck>true</SDLCheck>
-      <WholeProgramOptimization>true</WholeProgramOptimization>
-      <PreprocessKeepComments>false</PreprocessKeepComments>
-      <ExceptionHandling>SyncCThrow</ExceptionHandling>
-      <StructMemberAlignment>8Bytes</StructMemberAlignment>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <RuntimeTypeInfo>false</RuntimeTypeInfo>
-      <OmitDefaultLibName>true</OmitDefaultLibName>
-      <CompileAs>CompileAsCpp</CompileAs>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib</AdditionalDependencies>
-      <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;REQUESTHANDLER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <AdditionalIncludeDirectories>..\IISLib;..\CommonLib;.\Inc;..\RequestHandlerLib</AdditionalIncludeDirectories>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <SDLCheck>true</SDLCheck>
-      <WholeProgramOptimization>true</WholeProgramOptimization>
-      <PreprocessKeepComments>false</PreprocessKeepComments>
-      <ExceptionHandling>SyncCThrow</ExceptionHandling>
-      <StructMemberAlignment>8Bytes</StructMemberAlignment>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <RuntimeTypeInfo>false</RuntimeTypeInfo>
-      <OmitDefaultLibName>true</OmitDefaultLibName>
-      <CompileAs>CompileAsCpp</CompileAs>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>false</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions)</AdditionalOptions>
-      <OptimizeReferences>true</OptimizeReferences>
-      <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
-      <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib</AdditionalDependencies>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' OR '$(Configuration)|$(Platform)'=='Release|ARM64' OR '$(Configuration)|$(Platform)'=='Release|Any CPU'">
+  <ItemDefinitionGroup>
     <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>NDEBUG;REQUESTHANDLER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+      <PreprocessorDefinitions>REQUESTHANDLER_EXPORTS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\IISLib;..\CommonLib;.\Inc;..\RequestHandlerLib</AdditionalIncludeDirectories>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <SDLCheck>true</SDLCheck>
-      <WholeProgramOptimization>true</WholeProgramOptimization>
-      <PreprocessKeepComments>false</PreprocessKeepComments>
-      <ExceptionHandling>SyncCThrow</ExceptionHandling>
-      <StructMemberAlignment>8Bytes</StructMemberAlignment>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <RuntimeTypeInfo>false</RuntimeTypeInfo>
-      <OmitDefaultLibName>true</OmitDefaultLibName>
-      <CompileAs>CompileAsCpp</CompileAs>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
     </ClCompile>
     <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>false</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions)</AdditionalOptions>
-      <OptimizeReferences>true</OptimizeReferences>
-      <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
-      <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib</AdditionalDependencies>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+      <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib;$(LibNetHostPath)\libnethost.lib</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>

+ 4 - 215
src/Servers/IIS/AspNetCoreModuleV2/OutOfProcessRequestHandler/OutOfProcessRequestHandler.vcxproj

@@ -1,235 +1,24 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\..\build\Build.Settings" />
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|ARM64">
-      <Configuration>Debug</Configuration>
-      <Platform>ARM64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Any CPU">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|ARM64">
-      <Configuration>Release</Configuration>
-      <Platform>ARM64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Any CPU">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
   <PropertyGroup Label="Globals">
-    <VCProjectVersion>15.0</VCProjectVersion>
     <ProjectGuid>{7F87406C-A3C8-4139-A68D-E4C344294A67}</ProjectGuid>
-    <Keyword>Win32Proj</Keyword>
     <RootNamespace>OutOfProcessRequestHandler</RootNamespace>
-    <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
-    <PlatformToolsetVersion Condition=" '$(VisualStudioVersion)' == '17.0' ">v143</PlatformToolsetVersion>
-    <PlatformToolsetVersion Condition=" '$(PlatformToolsetVersion)' == '' ">v142</PlatformToolsetVersion>
     <ProjectName>OutOfProcessRequestHandler</ProjectName>
   </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Label="Configuration">
-    <VCToolsVersion />
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Debug|ARM64' OR '$(Configuration)|$(Platform)'=='Debug|Any CPU'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' OR '$(Configuration)|$(Platform)'=='Release|ARM64' OR '$(Configuration)|$(Platform)'=='Release|Any CPU'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="Shared">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
+  <Import Project="..\..\build\Build.Dll.Settings" />
   <PropertyGroup>
     <TargetName>aspnetcorev2_outofprocess</TargetName>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)'=='Debug'">
-    <LinkIncremental>false</LinkIncremental>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;REQUESTHANDLER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <AdditionalIncludeDirectories>..\IISLib;..\CommonLib;.\Inc;..\RequestHandlerLib</AdditionalIncludeDirectories>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <SDLCheck>true</SDLCheck>
-      <WholeProgramOptimization>true</WholeProgramOptimization>
-      <PreprocessKeepComments>false</PreprocessKeepComments>
-      <ExceptionHandling>SyncCThrow</ExceptionHandling>
-      <StructMemberAlignment>8Bytes</StructMemberAlignment>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <RuntimeTypeInfo>false</RuntimeTypeInfo>
-      <OmitDefaultLibName>true</OmitDefaultLibName>
-      <CompileAs>CompileAsCpp</CompileAs>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib;Rpcrt4.lib;winhttp.lib</AdditionalDependencies>
-      <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Debug|ARM64' OR '$(Configuration)|$(Platform)'=='Debug|Any CPU'">
-    <ClCompile>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;REQUESTHANDLER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <AdditionalIncludeDirectories>..\IISLib;..\CommonLib;.\Inc;..\RequestHandlerLib</AdditionalIncludeDirectories>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <SDLCheck>true</SDLCheck>
-      <WholeProgramOptimization>true</WholeProgramOptimization>
-      <PreprocessKeepComments>false</PreprocessKeepComments>
-      <ExceptionHandling>SyncCThrow</ExceptionHandling>
-      <StructMemberAlignment>8Bytes</StructMemberAlignment>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <RuntimeTypeInfo>false</RuntimeTypeInfo>
-      <OmitDefaultLibName>true</OmitDefaultLibName>
-      <CompileAs>CompileAsCpp</CompileAs>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib;Rpcrt4.lib;winhttp.lib</AdditionalDependencies>
-      <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;REQUESTHANDLER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <AdditionalIncludeDirectories>..\IISLib;..\CommonLib;.\Inc;..\RequestHandlerLib</AdditionalIncludeDirectories>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <SDLCheck>true</SDLCheck>
-      <WholeProgramOptimization>true</WholeProgramOptimization>
-      <PreprocessKeepComments>false</PreprocessKeepComments>
-      <ExceptionHandling>SyncCThrow</ExceptionHandling>
-      <StructMemberAlignment>8Bytes</StructMemberAlignment>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <RuntimeTypeInfo>false</RuntimeTypeInfo>
-      <OmitDefaultLibName>true</OmitDefaultLibName>
-      <CompileAs>CompileAsCpp</CompileAs>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>false</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions)</AdditionalOptions>
-      <OptimizeReferences>true</OptimizeReferences>
-      <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
-      <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib;Rpcrt4.lib;winhttp.lib</AdditionalDependencies>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' OR '$(Configuration)|$(Platform)'=='Release|ARM64' OR '$(Configuration)|$(Platform)'=='Release|Any CPU'">
+  <ItemDefinitionGroup>
     <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <PrecompiledHeader>Use</PrecompiledHeader>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>NDEBUG;REQUESTHANDLER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+      <PreprocessorDefinitions>REQUESTHANDLER_EXPORTS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>..\IISLib;..\CommonLib;.\Inc;..\RequestHandlerLib</AdditionalIncludeDirectories>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <SDLCheck>true</SDLCheck>
-      <WholeProgramOptimization>true</WholeProgramOptimization>
-      <PreprocessKeepComments>false</PreprocessKeepComments>
-      <ExceptionHandling>SyncCThrow</ExceptionHandling>
-      <StructMemberAlignment>8Bytes</StructMemberAlignment>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <RuntimeTypeInfo>false</RuntimeTypeInfo>
-      <OmitDefaultLibName>true</OmitDefaultLibName>
-      <CompileAs>CompileAsCpp</CompileAs>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
     </ClCompile>
     <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>false</GenerateDebugInformation>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions)</AdditionalOptions>
-      <OptimizeReferences>true</OptimizeReferences>
-      <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
-      <AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib;Rpcrt4.lib;winhttp.lib</AdditionalDependencies>
-      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+<AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;ws2_32.lib;iphlpapi.lib;version.lib;Rpcrt4.lib;winhttp.lib</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>

+ 3 - 186
src/Servers/IIS/AspNetCoreModuleV2/RequestHandlerLib/RequestHandlerLib.vcxproj

@@ -1,198 +1,15 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|ARM64">
-      <Configuration>Debug</Configuration>
-      <Platform>ARM64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Any CPU">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|ARM64">
-      <Configuration>Release</Configuration>
-      <Platform>ARM64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Any CPU">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
+  <Import Project="..\..\build\Build.Lib.Settings" />
   <PropertyGroup Label="Globals">
-    <VCProjectVersion>15.0</VCProjectVersion>
     <ProjectGuid>{1533E271-F61B-441B-8B74-59FB61DF0552}</ProjectGuid>
-    <Keyword>Win32Proj</Keyword>
     <RootNamespace>NewCommon</RootNamespace>
-    <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
-    <PlatformToolsetVersion Condition=" '$(VisualStudioVersion)' == '17.0' ">v143</PlatformToolsetVersion>
-    <PlatformToolsetVersion Condition=" '$(PlatformToolsetVersion)' == '' ">v142</PlatformToolsetVersion>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Label="Configuration">
-    <VCToolsVersion />
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Debug|ARM64' OR '$(Configuration)|$(Platform)'=='Debug|Any CPU'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' OR '$(Configuration)|$(Platform)'=='Release|ARM64' OR '$(Configuration)|$(Platform)'=='Release|Any CPU'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <WholeProgramOptimization>false</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="Shared">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)'=='Debug'">
-    <LinkIncremental>true</LinkIncremental>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)'=='Release'">
-    <LinkIncremental>false</LinkIncremental>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <WarningLevel>Level4</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <Optimization>Disabled</Optimization>
-      <SDLCheck>false</SDLCheck>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <ConformanceMode>true</ConformanceMode>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <ShowIncludes>false</ShowIncludes>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <AdditionalIncludeDirectories>..\iislib;..\CommonLib;</AdditionalIncludeDirectories>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Debug|ARM64' OR '$(Configuration)|$(Platform)'=='Debug|Any CPU'">
-    <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <WarningLevel>Level4</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <Optimization>Disabled</Optimization>
-      <SDLCheck>false</SDLCheck>
-      <PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <ConformanceMode>true</ConformanceMode>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <MinimalRebuild>false</MinimalRebuild>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <ShowIncludes>false</ShowIncludes>
-      <AdditionalIncludeDirectories>..\iislib;..\CommonLib;</AdditionalIncludeDirectories>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <WarningLevel>Level4</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <SDLCheck>false</SDLCheck>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <ConformanceMode>true</ConformanceMode>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <ShowIncludes>false</ShowIncludes>
-      <AdditionalIncludeDirectories>..\iislib;..\CommonLib;</AdditionalIncludeDirectories>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <LanguageStandard>stdcpp17</LanguageStandard>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions)</AdditionalOptions>
-      <OptimizeReferences>true</OptimizeReferences>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' OR '$(Configuration)|$(Platform)'=='Release|ARM64' OR '$(Configuration)|$(Platform)'=='Release|Any CPU'">
+  <ItemDefinitionGroup>
     <ClCompile>
       <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <WarningLevel>Level4</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <SDLCheck>false</SDLCheck>
-      <PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <ConformanceMode>true</ConformanceMode>
       <AdditionalIncludeDirectories>..\iislib;..\CommonLib;</AdditionalIncludeDirectories>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <AdditionalUsingDirectories>
-      </AdditionalUsingDirectories>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <ShowIncludes>false</ShowIncludes>
-      <LanguageStandard>stdcpp17</LanguageStandard>
     </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions)</AdditionalOptions>
-      <OptimizeReferences>true</OptimizeReferences>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
-    <Lib>
-      <AdditionalLibraryDirectories>..\iislib</AdditionalLibraryDirectories>
-    </Lib>
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClInclude Include="AppOfflineTrackingApplication.h" />
@@ -222,4 +39,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>

+ 5 - 157
src/Servers/IIS/AspNetCoreModuleV2/gtest/gtest.vcxproj

@@ -1,181 +1,29 @@
 <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|ARM64">
-      <Configuration>Debug</Configuration>
-      <Platform>ARM64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|Any CPU">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|ARM64">
-      <Configuration>Release</Configuration>
-      <Platform>ARM64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Any CPU">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
+  <Import Project="..\..\build\Build.Lib.Settings" />
   <ItemGroup>
     <ClCompile Include="$(GoogleTestSubmoduleRoot)\googlemock\src\gmock-all.cc" />
     <ClCompile Include="$(GoogleTestSubmoduleRoot)\googletest\src\gtest-all.cc" />
   </ItemGroup>
   <PropertyGroup Label="Globals">
-    <VCProjectVersion>15.0</VCProjectVersion>
     <ProjectGuid>{CAC1267B-8778-4257-AAC6-CAF481723B01}</ProjectGuid>
-    <Keyword>Win32Proj</Keyword>
     <RootNamespace>gtest</RootNamespace>
-    <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
-    <PlatformToolsetVersion Condition=" '$(VisualStudioVersion)' == '17.0' ">v143</PlatformToolsetVersion>
-    <PlatformToolsetVersion Condition=" '$(PlatformToolsetVersion)' == '' ">v142</PlatformToolsetVersion>
   </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Label="Configuration">
-    <VCToolsVersion />
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <CharacterSet>Unicode</CharacterSet>
-    <TargetName>gtestd</TargetName>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
     <TargetName>gtest</TargetName>
+    <TargetName Condition="'$(Configuration)'=='Debug'">gtestd</TargetName>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Debug|ARM64' OR '$(Configuration)|$(Platform)'=='Debug|Any CPU'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <CharacterSet>Unicode</CharacterSet>
-    <TargetName>gtestd</TargetName>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' OR '$(Configuration)|$(Platform)'=='Release|ARM64' OR '$(Configuration)|$(Platform)'=='Release|Any CPU'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>Unicode</CharacterSet>
-    <TargetName>gtest</TargetName>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="Shared">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)'=='Debug'">
-    <LinkIncremental>true</LinkIncremental>
+  <PropertyGroup>
     <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
     <SourcePath>$(VC_SourcePath);</SourcePath>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)'=='Release'">
-    <LinkIncremental>false</LinkIncremental>
-    <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
-    <SourcePath>$(VC_SourcePath);</SourcePath>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <WarningLevel>Level3</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <SDLCheck>true</SDLCheck>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ConformanceMode>true</ConformanceMode>
-      <AdditionalIncludeDirectories>$(GoogleTestSubmoduleRoot)googletest\include;$(GoogleTestSubmoduleRoot)googletest;$(GoogleTestSubmoduleRoot)googlemock;$(GoogleTestSubmoduleRoot)googlemock\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' OR '$(Configuration)|$(Platform)'=='Debug|ARM64' OR '$(Configuration)|$(Platform)'=='Debug|Any CPU'">
-    <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <WarningLevel>Level3</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <SDLCheck>true</SDLCheck>
-      <PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ConformanceMode>true</ConformanceMode>
-      <AdditionalIncludeDirectories>$(GoogleTestSubmoduleRoot)googletest\include;$(GoogleTestSubmoduleRoot)googletest;$(GoogleTestSubmoduleRoot)googlemock;$(GoogleTestSubmoduleRoot)googlemock\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
-      <WarningLevel>Level3</WarningLevel>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <SDLCheck>true</SDLCheck>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ConformanceMode>true</ConformanceMode>
-      <AdditionalIncludeDirectories>$(GoogleTestSubmoduleRoot)googletest\include;$(GoogleTestSubmoduleRoot)googletest;$(GoogleTestSubmoduleRoot)googlemock;$(GoogleTestSubmoduleRoot)googlemock\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
-    </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' OR '$(Configuration)|$(Platform)'=='Release|ARM64' OR '$(Configuration)|$(Platform)'=='Release|Any CPU'">
+  <ItemDefinitionGroup>
     <ClCompile>
       <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <ForcedIncludeFiles />
       <WarningLevel>Level3</WarningLevel>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
       <SDLCheck>true</SDLCheck>
-      <PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ConformanceMode>true</ConformanceMode>
       <AdditionalIncludeDirectories>$(GoogleTestSubmoduleRoot)googletest\include;$(GoogleTestSubmoduleRoot)googletest;$(GoogleTestSubmoduleRoot)googlemock;$(GoogleTestSubmoduleRoot)googlemock\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <MultiProcessorCompilation>true</MultiProcessorCompilation>
     </ClCompile>
-    <Link>
-      <SubSystem>Windows</SubSystem>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
   </ItemDefinitionGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">

+ 7 - 0
src/Servers/IIS/Directory.Build.props

@@ -1,6 +1,13 @@
 <Project>
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" />
+  
   <PropertyGroup>
     <KestrelSharedSourceRoot>$(MSBuildThisFileDirectory)..\Kestrel\shared\</KestrelSharedSourceRoot>
+    <HostArch>$(Platform)</HostArch>
+    <HostArch Condition="'$(Platform)' == 'Win32'">x86</HostArch>
+    <HostArch Condition="'$(Platform)' == 'AnyCPU'">x64</HostArch>
+    <LibNetHostPath>$(NetCoreTargetingPackRoot)Microsoft.NETCore.App.Host.win-$(HostArch)\$(LibNetHostAppPackVersion)\runtimes\win-$(HostArch)\native</LibNetHostPath>
+    <!-- This tools version MUST match the same version as runtime uses to compile libnethost.lib -->
+    <PlatformToolsetVersion>v142</PlatformToolsetVersion>
   </PropertyGroup>
 </Project>

+ 0 - 1
src/Servers/IIS/IIS/test/Common.FunctionalTests/FrebTests.cs

@@ -31,7 +31,6 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests;
 #endif
 
 [Collection(PublishedSitesCollection.Name)]
-[SkipNonHelix("https://github.com/dotnet/aspnetcore/issues/25107")]
 public class FrebTests : IISFunctionalTestBase
 {
     public FrebTests(PublishedSitesFixture fixture) : base(fixture)

+ 8 - 5
src/Servers/IIS/IIS/test/Common.FunctionalTests/GlobalVersionTests.cs

@@ -54,7 +54,6 @@ public class GlobalVersionTests : IISFunctionalTestBase
     }
 
     [ConditionalFact]
-    [MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10_20H2, SkipReason = "Shutdown hangs https://github.com/dotnet/aspnetcore/issues/25107")]
     [RequiresIIS(IISCapability.PoolEnvironmentVariables)]
     [RequiresNewShim]
     public async Task GlobalVersion_EnvironmentVariableWorks()
@@ -87,6 +86,8 @@ public class GlobalVersionTests : IISFunctionalTestBase
     [ConditionalTheory]
     [InlineData("2.1.0")]
     [InlineData("2.1.0-preview")]
+    [InlineData("7.0.0")]
+    [InlineData("7.0.0-preview")]
     public async Task GlobalVersion_NewVersionNumber_Fails(string version)
     {
         var deploymentParameters = GetGlobalVersionBaseDeploymentParameters();
@@ -101,9 +102,10 @@ public class GlobalVersionTests : IISFunctionalTestBase
     }
 
     [ConditionalTheory]
-    [MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10_20H2, SkipReason = "Shutdown hangs https://github.com/dotnet/aspnetcore/issues/25107")]
     [InlineData("2.1.0")]
     [InlineData("2.1.0-preview")]
+    [InlineData("7.0.0")]
+    [InlineData("7.0.0-preview")]
     public async Task GlobalVersion_NewVersionNumber(string version)
     {
         var deploymentParameters = GetGlobalVersionBaseDeploymentParameters();
@@ -123,9 +125,10 @@ public class GlobalVersionTests : IISFunctionalTestBase
     }
 
     [ConditionalTheory]
-    [MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10_20H2, SkipReason = "Shutdown hangs https://github.com/dotnet/aspnetcore/issues/25107")]
     [InlineData("2.1.0")]
     [InlineData("2.1.0-preview")]
+    [InlineData("7.0.0")]
+    [InlineData("7.0.0-preview")]
     public async Task GlobalVersion_MultipleRequestHandlers_PicksHighestOne(string version)
     {
         var deploymentParameters = GetGlobalVersionBaseDeploymentParameters();
@@ -147,9 +150,10 @@ public class GlobalVersionTests : IISFunctionalTestBase
     }
 
     [ConditionalTheory]
-    [MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10_20H2, SkipReason = "Shutdown hangs https://github.com/dotnet/aspnetcore/issues/25107")]
     [InlineData("2.1.0")]
     [InlineData("2.1.0-preview")]
+    [InlineData("7.0.0")]
+    [InlineData("7.0.0-preview")]
     public async Task GlobalVersion_MultipleRequestHandlers_UpgradeWorks(string version)
     {
         var deploymentParameters = GetGlobalVersionBaseDeploymentParameters();
@@ -262,5 +266,4 @@ public class GlobalVersionTests : IISFunctionalTestBase
             fileInfo.CopyTo(destFileName, overwrite: true);
         }
     }
-
 }

+ 0 - 1
src/Servers/IIS/IIS/test/Common.FunctionalTests/LoggingTests.cs

@@ -29,7 +29,6 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests;
 #endif
 
 [Collection(PublishedSitesCollection.Name)]
-[SkipNonHelix("https://github.com/dotnet/aspnetcore/issues/25107")]
 public class LoggingTests : IISFunctionalTestBase
 {
     public LoggingTests(PublishedSitesFixture fixture) : base(fixture)

+ 0 - 1
src/Servers/IIS/IIS/test/Common.FunctionalTests/MaxRequestBodySizeTests.cs

@@ -131,7 +131,6 @@ public class MaxRequestBodySizeTests : IISFunctionalTestBase
     }
 
     [ConditionalFact]
-    [MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10_20H2, SkipReason = "Shutdown hangs https://github.com/dotnet/aspnetcore/issues/25107")]
     [RequiresNewHandler]
     [RequiresIIS(IISCapability.PoolEnvironmentVariables)]
     public async Task SetIISLimitMaxRequestBodyLogsWarning()

+ 0 - 2
src/Servers/IIS/IIS/test/Common.FunctionalTests/MultiApplicationTests.cs

@@ -49,7 +49,6 @@ public class MultiApplicationTests : IISFunctionalTestBase
     }
 
     [ConditionalFact]
-    [MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10_20H2, SkipReason = "Shutdown hangs https://github.com/dotnet/aspnetcore/issues/25107")]
     public async Task FailsAndLogsWhenRunningTwoInProcessApps()
     {
         var parameters = Fixture.GetBaseDeploymentParameters(HostingModel.InProcess);
@@ -71,7 +70,6 @@ public class MultiApplicationTests : IISFunctionalTestBase
     }
 
     [ConditionalTheory]
-    [MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10_20H2, SkipReason = "Shutdown hangs https://github.com/dotnet/aspnetcore/issues/25107")]
     [InlineData(HostingModel.OutOfProcess)]
     [InlineData(HostingModel.InProcess)]
     public async Task FailsAndLogsEventLogForMixedHostingModel(HostingModel firstApp)

+ 0 - 7
src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs

@@ -1,20 +1,14 @@
 // 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.Collections.Generic;
-using System.IO;
-using System.Linq;
 using System.Net;
 using System.Net.Http;
 using System.Net.Sockets;
-using System.Threading.Tasks;
 using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
 using Microsoft.AspNetCore.Server.IntegrationTesting;
 using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
 using Microsoft.AspNetCore.Testing;
 using Microsoft.Extensions.Logging;
-using Xunit;
 
 #if !IIS_FUNCTIONALS
 using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
@@ -33,7 +27,6 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests;
 
 // Contains all tests related to shutdown, including app_offline, abort, and app recycle
 [Collection(PublishedSitesCollection.Name)]
-[SkipNonHelix("https://github.com/dotnet/aspnetcore/issues/25107")]
 public class ShutdownTests : IISFunctionalTestBase
 {
     public ShutdownTests(PublishedSitesFixture fixture) : base(fixture)

+ 0 - 8
src/Servers/IIS/IIS/test/Common.LongTests/StartupTests.cs

@@ -1,17 +1,11 @@
 // 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.Collections.Generic;
 using System.Diagnostics;
-using System.IO;
-using System.Linq;
 using System.Net;
 using System.Net.Http;
 using System.Net.Sockets;
 using System.Text.RegularExpressions;
-using System.Threading;
-using System.Threading.Tasks;
 using System.Xml.Linq;
 using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
 using Microsoft.AspNetCore.Server.IntegrationTesting;
@@ -19,7 +13,6 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.Common;
 using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
 using Microsoft.AspNetCore.Testing;
 using Microsoft.Win32;
-using Xunit;
 
 #if !IIS_FUNCTIONALS
 using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
@@ -38,7 +31,6 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests;
 
 // Contains all tests related to Startup, requiring starting ANCM/IIS every time.
 [Collection(PublishedSitesCollection.Name)]
-[SkipNonHelix("https://github.com/dotnet/aspnetcore/issues/25107")]
 public class StartupTests : IISFunctionalTestBase
 {
     public StartupTests(PublishedSitesFixture fixture) : base(fixture)

+ 1 - 0
src/Servers/IIS/IIS/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj

@@ -4,6 +4,7 @@
     <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
     <TestGroupName>IIS.FunctionalTests</TestGroupName>
     <DefineConstants>IIS_FUNCTIONALS</DefineConstants>
+    <DisableFastUpToDateCheck>True</DisableFastUpToDateCheck>
     <SkipTests Condition=" '$(SkipIISTests)' == 'true' ">true</SkipTests>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>

+ 1 - 0
src/Servers/IIS/IIS/test/IIS.NewHandler.FunctionalTests/IIS.NewHandler.FunctionalTests.csproj

@@ -4,6 +4,7 @@
     <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
     <TestGroupName>IISNewHandler.FunctionalTests</TestGroupName>
     <DefineConstants>NEWHANDLER_FUNCTIONALS</DefineConstants>
+    <DisableFastUpToDateCheck>True</DisableFastUpToDateCheck>
     <SkipTests Condition=" '$(SkipIISNewHandlerTests)' == 'true' ">true</SkipTests>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>

+ 1 - 0
src/Servers/IIS/IIS/test/IIS.NewShim.FunctionalTests/IIS.NewShim.FunctionalTests.csproj

@@ -5,6 +5,7 @@
     <TestGroupName>IISNewShim.FunctionalTests</TestGroupName>
     <DefineConstants>NEWSHIM_FUNCTIONALS</DefineConstants>
     <SkipTests Condition=" '$(SkipIISNewShimTests)' == 'true' ">true</SkipTests>
+    <DisableFastUpToDateCheck>True</DisableFastUpToDateCheck>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>
 

+ 0 - 2
src/Servers/IIS/IIS/test/IIS.NewShim.FunctionalTests/NewShimTests.cs

@@ -2,11 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 
 using System.Diagnostics;
-using System.Threading.Tasks;
 using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
 using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
 using Microsoft.AspNetCore.Testing;
-using Xunit;
 using Xunit.Sdk;
 
 namespace Microsoft.AspNetCore.Server.IIS.NewShim.FunctionalTests;

+ 1 - 0
src/Servers/IIS/IIS/test/IIS.ShadowCopy.Tests/IIS.ShadowCopy.Tests.csproj

@@ -3,6 +3,7 @@
   <PropertyGroup>
     <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
     <TestGroupName>IIS.ShadowCopy.Tests</TestGroupName>
+    <DisableFastUpToDateCheck>True</DisableFastUpToDateCheck>
     <SkipTests Condition=" '$(SkipIISTests)' == 'true' ">true</SkipTests>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>

+ 1 - 0
src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj

@@ -7,6 +7,7 @@
     <DefineConstants>IISEXPRESS_FUNCTIONALS</DefineConstants>
     <TestGroupName>IISExpress.FunctionalTests</TestGroupName>
     <SkipTests Condition=" '$(SkipIISExpressTests)' == 'true' ">true</SkipTests>
+    <DisableFastUpToDateCheck>True</DisableFastUpToDateCheck>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>
 

+ 1 - 0
src/Servers/IIS/IISIntegration.slnf

@@ -41,6 +41,7 @@
       "src\\Servers\\IIS\\IIS\\test\\IIS.NewHandler.FunctionalTests\\IIS.NewHandler.FunctionalTests.csproj",
       "src\\Servers\\IIS\\IIS\\test\\IIS.NewShim.FunctionalTests\\IIS.NewShim.FunctionalTests.csproj",
       "src\\Servers\\IIS\\IIS\\test\\IIS.ShadowCopy.Tests\\IIS.ShadowCopy.Tests.csproj",
+      "src\\Servers\\IIS\\IIS\\test\\IIS.LongTests\\IIS.LongTests.csproj",
       "src\\Servers\\IIS\\IIS\\test\\IIS.Tests\\IIS.Tests.csproj",
       "src\\Servers\\IIS\\IIS\\test\\IISExpress.FunctionalTests\\IISExpress.FunctionalTests.csproj",
       "src\\Servers\\IIS\\IIS\\test\\testassets\\IIS.Common.TestLib\\IIS.Common.TestLib.csproj",

+ 64 - 0
src/Servers/IIS/build/Build.Common.Settings

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+  <Import Project="Config.Definitions.Props" />
+
+  <PropertyGroup>
+    <_TwoDigitYear>$([MSBuild]::Subtract($([System.DateTime]::UtcNow.Year), 2000))</_TwoDigitYear>
+    <_ThreeDigitDayOfYear>$([System.DateTime]::UtcNow.DayOfYear.ToString().PadLeft(3, '0'))</_ThreeDigitDayOfYear>
+    <AssemblyBuild>$(_TwoDigitYear)$(_ThreeDigitDayOfYear)</AssemblyBuild>
+  </PropertyGroup>
+
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+
+  <PropertyGroup Label="Configuration">
+    <SolutionDir Condition="'$(SolutionDir)' == '' Or '$(SolutionDir)' == '*Undefined*'">$(MSBuildThisFileDirectory)..\</SolutionDir>
+    <Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
+    <VCProjectVersion>15.0</VCProjectVersion>
+    <VCToolsVersion>14.29.30133</VCToolsVersion>
+    <Keyword>Win32Proj</Keyword>
+    <Platform Condition="'$(Platform)' == ''">x64</Platform>
+    <PlatformToolsetVersion>v142</PlatformToolsetVersion>
+    <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
+    <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+
+  <Import Project="release.props" />
+  <Import Project="debug.props" />
+
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+
+  <ImportGroup Label="ExtensionSettings" />
+  <ImportGroup Label="Shared" />
+  <ImportGroup Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+
+  <ItemDefinitionGroup>
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
+      <TreatWarningAsError>true</TreatWarningAsError>
+      <WarningLevel>Level4</WarningLevel>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+      <ShowIncludes>false</ShowIncludes>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <LanguageStandard>stdcpp17</LanguageStandard>
+      <CompileAs>CompileAsCpp</CompileAs>
+
+      <PreprocessorDefinitions>_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Platform)'=='Win32'">WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Platform)'=='x64'">_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Platform)'=='arm64'">_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <!-- https://github.com/dotnet/runtime/issues/63602 libnethost.lib missing symbols -->
+      <AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
+      <SubSystem>Windows</SubSystem>
+    </Link>
+  </ItemDefinitionGroup>
+</Project>

+ 32 - 0
src/Servers/IIS/build/Build.Dll.Settings

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Common build settings for C++ Dll projects -->
+<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Label="Configuration">
+    <AspNetCoreModuleTargetName>aspnetcore</AspNetCoreModuleTargetName>
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+  </PropertyGroup>
+
+  <Import Project="Build.Common.Settings" />
+
+  <ItemDefinitionGroup>
+    <ClCompile>
+      <PreprocessorDefinitions>_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessKeepComments>false</PreprocessKeepComments>
+      <ControlFlowGuard>Guard</ControlFlowGuard>
+      <ExceptionHandling>SyncCThrow</ExceptionHandling>
+      <StructMemberAlignment>8Bytes</StructMemberAlignment>
+      <OmitDefaultLibName>true</OmitDefaultLibName>
+    </ClCompile>
+    <Link>
+      <!-- This is needed for the corehostr tracing tests to work in StdOutRedirectionTests -->
+      <AdditionalOptions>/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib %(AdditionalOptions)</AdditionalOptions>
+      <AdditionalLibraryDirectories>$(LibNetHostPath)</AdditionalLibraryDirectories>
+      <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
+      <StripPrivateSymbols>$(OutDir)$(TargetName).pub.pdb</StripPrivateSymbols>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <Profile>true</Profile>
+      <ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
+    </Link>
+  </ItemDefinitionGroup>
+</Project>

+ 17 - 0
src/Servers/IIS/build/Build.Lib.Settings

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Common build settings for C++ static lib projects -->
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+  </PropertyGroup>
+
+  <Import Project="Build.Common.Settings" />
+
+  <ItemDefinitionGroup>
+    <ClCompile>
+      <SDLCheck>false</SDLCheck>
+      <PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+  </ItemDefinitionGroup>
+</Project>

+ 0 - 95
src/Servers/IIS/build/Build.Settings

@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
- <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-   <PropertyGroup>
-     <SolutionDir Condition="'$(SolutionDir)' == '' Or '$(SolutionDir)' == '*Undefined*'">$(MSBuildThisFileDirectory)..\</SolutionDir>
-     <Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
-     <Platform Condition="'$(Platform)' == ''">Win32</Platform>
-     <PlatformToolsetVersion Condition=" '$(VisualStudioVersion)' == '17.0' ">v143</PlatformToolsetVersion>
-     <PlatformToolsetVersion Condition=" '$(PlatformToolsetVersion)' == '' ">v142</PlatformToolsetVersion>
-     <PlatformToolset>$(PlatformToolsetVersion)</PlatformToolset>
-     <AspNetCoreModuleTargetName>aspnetcore</AspNetCoreModuleTargetName>
-   </PropertyGroup>
-
-   <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
-     <UseDebugLibraries>true</UseDebugLibraries>
-     <WholeProgramOptimization>false</WholeProgramOptimization>
-   </PropertyGroup>
-
-   <PropertyGroup Condition="'$(Configuration)' == 'Release'">
-     <UseDebugLibraries>false</UseDebugLibraries>
-     <WholeProgramOptimization>true</WholeProgramOptimization>
-     <CodeAnalysisRuleSet>..\DefaultRules.ruleset</CodeAnalysisRuleSet>
-     <RunCodeAnalysis>false</RunCodeAnalysis>
-     <EnablePREfast>$(RunCodeAnalysis)</EnablePREfast>
-   </PropertyGroup>
-
-   <ItemDefinitionGroup>
-     <ClCompile>
-       <PrecompiledHeader>Use</PrecompiledHeader>
-       <TreatWarningAsError Condition="'$(TreatWarningsAsErrors)' != ''">true</TreatWarningAsError>
-       <SDLCheck>true</SDLCheck>
-       <ControlFlowGuard>Guard</ControlFlowGuard>
-       <StringPooling>true</StringPooling>
-     </ClCompile>
-     <Link>
-       <SubSystem>Windows</SubSystem>
-       <GenerateDebugInformation>true</GenerateDebugInformation>
-       <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
-       <StripPrivateSymbols>$(OutDir)$(TargetName).pub.pdb</StripPrivateSymbols>
-       <OptimizeReferences>true</OptimizeReferences>
-       <EnableCOMDATFolding>true</EnableCOMDATFolding>
-       <Profile>true</Profile>
-     </Link>
-   </ItemDefinitionGroup>
-
-   <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
-     <ClCompile>
-       <Optimization>Disabled</Optimization>
-     </ClCompile>
-   </ItemDefinitionGroup>
-
-   <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
-     <ClCompile>
-       <Optimization>MaxSpeed</Optimization>
-       <FunctionLevelLinking>true</FunctionLevelLinking>
-       <IntrinsicFunctions>true</IntrinsicFunctions>
-     </ClCompile>
-   </ItemDefinitionGroup>
-
-   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-     <ClCompile>
-       <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-     </ClCompile>
-   </ItemDefinitionGroup>
-
-   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-     <ClCompile>
-       <PreprocessorDefinitions>_WIN64;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-     </ClCompile>
-   </ItemDefinitionGroup>
-
-   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-     <ClCompile>
-       <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-     </ClCompile>
-     <Link>
-       <GenerateDebugInformation>true</GenerateDebugInformation>
-     </Link>
-   </ItemDefinitionGroup>
-
-   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-     <ClCompile>
-       <PreprocessorDefinitions>_WIN64;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-     </ClCompile>
-     <Link>
-       <GenerateDebugInformation>true</GenerateDebugInformation>
-     </Link>
-   </ItemDefinitionGroup>
-
-  <PropertyGroup>
-    <_TwoDigitYear>$([MSBuild]::Subtract($([System.DateTime]::UtcNow.Year), 2000))</_TwoDigitYear>
-    <_ThreeDigitDayOfYear>$([System.DateTime]::UtcNow.DayOfYear.ToString().PadLeft(3, '0'))</_ThreeDigitDayOfYear>
-    <AssemblyBuild>$(_TwoDigitYear)$(_ThreeDigitDayOfYear)</AssemblyBuild>
-  </PropertyGroup>
-
- </Project>

+ 8 - 0
src/Servers/IIS/build/Config.Definitions.Props

@@ -9,6 +9,10 @@
        <Configuration>Debug</Configuration> 
        <Platform>x64</Platform> 
      </ProjectConfiguration> 
+     <ProjectConfiguration Include="Debug|ARM64"> 
+       <Configuration>Debug</Configuration> 
+       <Platform>ARM64</Platform> 
+     </ProjectConfiguration> 
      <ProjectConfiguration Include="Release|Win32"> 
        <Configuration>Release</Configuration> 
        <Platform>Win32</Platform> 
@@ -17,5 +21,9 @@
        <Configuration>Release</Configuration> 
        <Platform>x64</Platform> 
      </ProjectConfiguration> 
+     <ProjectConfiguration Include="Release|ARM64"> 
+       <Configuration>Release</Configuration> 
+       <Platform>ARM64</Platform> 
+     </ProjectConfiguration> 
    </ItemGroup> 
  </Project>

+ 30 - 0
src/Servers/IIS/build/debug.props

@@ -0,0 +1,30 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+  <!-- Common debug configuration -->
+
+  <PropertyGroup Condition="'$(Configuration)'=='Debug'">
+    <!-- there is no debug version of libnethost.lib currently -->
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>false</WholeProgramOptimization>
+  </PropertyGroup>
+
+  <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
+    <ClCompile>
+      <StringPooling>true</StringPooling>
+      <Optimization>Disabled</Optimization>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <!-- Default runtime is static multithreaded debug but we need to use MT due libnethost not having a debug version -->
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+
+      <!-- Without a debug version of libnethost.lib we cannot use _DEBUG -->
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+
+    <Link>
+      <OptimizeReferences>false</OptimizeReferences>
+      <EnableCOMDATFolding>false</EnableCOMDATFolding>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+
+</Project>

+ 42 - 0
src/Servers/IIS/build/release.props

@@ -0,0 +1,42 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+<!--
+  LinkIncremental (/INCREMENTAL:NO)    build does not contain padding or thunks
+-->
+
+  <PropertyGroup Condition="'$(Configuration)'=='Release'">
+    <LinkIncremental>false</LinkIncremental>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>false</WholeProgramOptimization>
+  </PropertyGroup>
+
+<!--
+  Optimization - Full (/Ox)    Uses maximum optimization
+  FavorSizeOrSpeed - Size (/Ot)    Favors fast code
+  RuntimeTypeInfo (GR-)    Disables run-time type information (RTTI)
+  FunctionLevelLinking (/Gy)    Enables function-level linking.
+  IntrinsicFunctions (/Oi) Requests the compiler to use intrinsic functions
+  StringPooling (/GF)    Enables string pooling.
+
+  OptimizeReferences (/OPT:REF)    eliminates functions and data that are never referenced
+  EnableCOMDATFolding (/OPT:ICF    perform identical COMDAT folding
+  LinkTimeCodeGeneration (/LCTG)    perform whole-program optimization
+-->
+
+  <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <StringPooling>true</StringPooling>
+    </ClCompile>
+    <Link>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+    </Link>
+  </ItemDefinitionGroup>
+
+</Project>

+ 4 - 2
src/Servers/IIS/tools/GenerateNativeAssets.ps1

@@ -128,9 +128,11 @@ $content = @"
 <!-- This file is autogenerated -->
 <Project>
     <PropertyGroup>
+        <UseIisNativeAssets Condition="'`$(SolutionName)' == 'IISIntegration'">true</UseIisNativeAssets>
         <PackNativeAssets Condition="'`$(UseIisNativeAssets)' == 'true'">true</PackNativeAssets>
-        <NativePlatform Condition="'`$(Platform)' == 'AnyCPU'">x64</NativePlatform>
-        <NativePlatform Condition="'`$(NativePlatform)' == ''">`$(Platform)</NativePlatform>
+        <PackNativeAssets Condition="'`$(UseIisNativeAssets)' != 'true'">false</PackNativeAssets>
+        <NativePlatform Condition="'`$(TargetArchitecture)' == 'AnyCPU'">x64</NativePlatform>
+        <NativePlatform Condition="'`$(NativePlatform)' == ''">`$(TargetArchitecture)</NativePlatform>
         <NativeVCPlatform Condition="'`$(NativePlatform)' == 'x86'">Win32</NativeVCPlatform>
         <NativeVCPlatform Condition="'`$(NativeVCPlatform)' == ''">`$(NativePlatform)</NativeVCPlatform>
     </PropertyGroup>

+ 7 - 0
src/Servers/test/FunctionalTests/HelloWorldTest.cs

@@ -15,6 +15,8 @@ namespace ServerComparison.FunctionalTests;
 
 public class HelloWorldTests : LoggedTest
 {
+    private const string DebugEnvironmentVariable = "ASPNETCORE_MODULE_DEBUG";
+
     public HelloWorldTests(ITestOutputHelper output) : base(output)
     {
     }
@@ -47,6 +49,11 @@ public class HelloWorldTests : LoggedTest
                 deploymentParameters.ServerConfigTemplateContent = Helpers.GetNginxConfigContent("nginx.conf");
             }
 
+            if (variant.Server == ServerType.IISExpress)
+            {
+                deploymentParameters.EnvironmentVariables[DebugEnvironmentVariable] = "console";
+            }
+
             using (var deployer = IISApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
             {
                 var deploymentResult = await deployer.DeployAsync();