Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use nethost.dll to find dotnet in ANCM #10829

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 64 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,69 @@
"*.*proj": "xml",
"*.props": "xml",
"*.targets": "xml",
"*.tasks": "xml"
"*.tasks": "xml",
"filesystem": "cpp",
"array": "cpp",
"initializer_list": "cpp",
"list": "cpp",
"random": "cpp",
"type_traits": "cpp",
"vector": "cpp",
"xhash": "cpp",
"xstring": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"algorithm": "cpp",
"atomic": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"cmath": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"exception": "cpp",
"fstream": "cpp",
"functional": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"new": "cpp",
"optional": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"utility": "cpp",
"xfacet": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstddef": "cpp",
"xtr1common": "cpp",
"iostream": "cpp",
"set": "cpp",
"sstream": "cpp"
}
}
3 changes: 3 additions & 0 deletions eng/Dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ and are generated based on the last package release.
<LatestPackageReference Include="xunit.assert" Version="$(XunitAssertPackageVersion)" />
<LatestPackageReference Include="xunit.extensibility.core" Version="$(XunitExtensibilityCorePackageVersion)" />
<LatestPackageReference Include="xunit.extensibility.execution" Version="$(XunitExtensibilityExecutionPackageVersion)" />

<LatestPackageReference Include="runtime.win-x64.Microsoft.NETCore.DotNetAppHost" Version="$(MicrosoftNetCoreDotNetAppHostPackageVersion)" />
<LatestPackageReference Include="runtime.win-x86.Microsoft.NETCore.DotNetAppHost" Version="$(MicrosoftNetCoreDotNetAppHostPackageVersion)" />
</ItemGroup>

</Project>
4 changes: 4 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@
<Uri>https://github.com/dotnet/core-setup</Uri>
<Sha>2bb2dcaeffb1dfeda077354449868ddac254bc3d</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.DotNetAppHost" Version="3.0.0-preview7-27810-02">
<Uri>https://github.com/dotnet/core-setup</Uri>
<Sha>3f9156d5d9b5ae4b100baeaa75011aaee88a3f4b</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<!-- Listed explicitly to workaround https://github.com/dotnet/cli/issues/10528 -->
Expand Down
2 changes: 2 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@
<MicrosoftExtensionsDependencyModelPackageVersion>3.0.0-preview8-27914-06</MicrosoftExtensionsDependencyModelPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>3.0.0-preview8-27914-06</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftNETCoreAppRuntimewinx64PackageVersion>3.0.0-preview8-27914-06</MicrosoftNETCoreAppRuntimewinx64PackageVersion>
<MicrosoftNetCoreDotNetAppHostPackageVersion>3.0.0-preview8-27914-06</MicrosoftNetCoreDotNetAppHostPackageVersion>
<NETStandardLibraryRefPackageVersion>2.1.0-preview8-27914-06</NETStandardLibraryRefPackageVersion>

<!-- Packages from dotnet/corefx -->
<MicrosoftBclAsyncInterfacesPackageVersion>1.0.0-preview8.19364.1</MicrosoftBclAsyncInterfacesPackageVersion>
<MicrosoftCSharpPackageVersion>4.6.0-preview8.19364.1</MicrosoftCSharpPackageVersion>
Expand Down
1 change: 1 addition & 0 deletions eng/targets/Cpp.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<Target Name="Pack" />
<Target Name="Restore" />
<Target Name="ResolveNuGetPackageAssets" />

<Target Name="Test" Condition="'$(IsTestProject)' == 'true'" >
<Warning Condition="'$(TestProjectSkipReason)' != ''" Text="Skipped $(MSBuildProjectFileName): $(TestProjectSkipReason)" />
<Exec Condition="'$(TestProjectSkipReason)' == ''" Command="&quot;$(TargetPath)&quot;" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@
<?define SchemaGuid = "ab582af2-d6c0-43f7-8412-76a19c65d7f2" ?>
<?define SchemaGuid32 = "e629b31a-3d56-4b5c-959c-586fc1c55599" ?>
<?define AspNetCoreV2ProgramFilesTargetPath = "$(var.AspNetCoreV2.TargetPath)" ?>
<?define NetHostProgramFilesTargetPath = "$(var.NetHost64bit)" ?>
<?define AspNetCoreV2HandlerProgramFilesTargetPath = "$(var.AspNetCoreV2Handler.TargetPath)" ?>
<?else ?>
<?define SchemaGuid = "e629b31a-3d56-4b5c-959c-586fc1c55599" ?>
<?define AspNetCoreV2ProgramFilesTargetPath = "$(var.AspNetCoreV2WoW64.TargetPath)" ?>
<?define NetHostProgramFilesTargetPath = "$(var.NetHost32bit)" ?>
<?define AspNetCoreV2HandlerProgramFilesTargetPath = "$(var.AspNetCoreV2HandlerWoW64.TargetPath)" ?>
<?endif ?>

Expand Down Expand Up @@ -177,6 +179,14 @@
<RegistryValue Name="TypesSupported" Type="integer" Value="7"/>
</RegistryKey>
</Component>
<Component Id="NetHost" Guid="2aa57b03-f4aa-4ed2-a3c1-4992507b299f" Win64="$(var.IsWin64)">
jkotalik marked this conversation as resolved.
Show resolved Hide resolved
<File Id="NetHostDll"
Name="nethost.dll"
Source="$(var.NetHostProgramFilesTargetPath)"
DiskId="1"
Vital="yes">
</File>
</Component>
<Directory Id="HandlerVersionDir" Name="$(var.ANCMFolderVersion)" >
<Component Id="AspNetCoreModuleHandler" Guid="559EF726-B25C-480F-AFA4-32D0BA8B2376" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleHandlerDll"
Expand Down Expand Up @@ -219,6 +229,14 @@
<RegistryValue Name="EventMessageFile" Type="expandable" Value="[#AspNetCoreModuleDll.wow]"/>
<RegistryValue Name="TypesSupported" Type="integer" Value="7"/>
</RegistryKey>
</Component>
<Component Id="NetHost.wow" Guid="877bc07b-1422-464f-b71c-8c1569bc0f54" Win64="no">
<File Id="NetHostDll.wow"
Name="nethost.dll"
Source="$(var.NetHost32bit)"
DiskId="1"
Vital="yes">
</File>
</Component>
<Directory Id="HandlerVersionDir32" Name="$(var.ANCMFolderVersion)" >
<Component Id="AspNetCoreModuleHandler.wow" Guid="0A8EDB50-7D85-4825-8010-D27EFAF061B6" Win64="no">
Expand Down Expand Up @@ -251,10 +269,12 @@
<!-- Feature Definition -->
<Feature Id="AspNetCoreModuleFeature" Title="!(loc.AspNetCoreModuleProductTitle)" Description="!(loc.AspNetCoreModuleProductDescription)" Level="1">
<ComponentRef Id="AspNetCoreModule"/>
<ComponentRef Id="NetHost"/>
<ComponentRef Id="AspNetCoreModuleHandler"/>
<ComponentRef Id="AspNetCoreSchema"/>
<?if $(var.Platform) = "x64" ?>
<ComponentRef Id="AspNetCoreModule.wow"/>
<ComponentRef Id="NetHost.wow"/>
<ComponentRef Id="AspNetCoreModuleHandler.wow"/>
<ComponentRef Id="AspNetCoreSchema.wow"/>
<?endif ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
<?if $(var.Platform) = "x64" ?>
<?define AspNetCoreV2ProgramFilesTargetPath = "$(var.AspNetCoreV2.TargetPath)" ?>
<?define AspNetCoreV2HandlerProgramFilesTargetPath = "$(var.AspNetCoreV2Handler.TargetPath)" ?>
<?define NetHostProgramFilesTargetPath = "$(var.NetHost64bit)" ?>
<?else ?>
<?define AspNetCoreV2ProgramFilesTargetPath = "$(var.AspNetCoreV2WoW64.TargetPath)" ?>
<?define AspNetCoreV2HandlerProgramFilesTargetPath = "$(var.AspNetCoreV2HandlerWoW64.TargetPath)" ?>
<?define NetHostProgramFilesTargetPath = "$(var.NetHost32bit)" ?>
<?endif ?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:dep="http://schemas.microsoft.com/wix/DependencyExtension">
Expand Down Expand Up @@ -144,7 +146,7 @@
<Directory Id="IISModuleDirectory" Name="IIS">
<Directory Id="INSTALLLOCATION" ShortName="ANCM" Name="Asp.Net Core Module">
<Directory Id="VersionDir" Name="$(var.ProductVersionString)">
<Component Id="AspNetCoreModuleV2" Guid="3a692941-59be-43cf-98a8-6ed01b12a519" Win64="$(var.IsWin64)">
<Component Id="AspNetCoreModuleV2" Guid="3a692941-59be-43cf-98a8-6ed01b12a519" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleV2Dll"
Name="aspnetcorev2.dll"
Source="$(var.AspNetCoreV2ProgramFilesTargetPath)"
Expand All @@ -156,6 +158,16 @@
<RegistryValue Name="EventMessageFile" Type="expandable" Value="[#AspNetCoreModuleV2Dll]"/>
<RegistryValue Name="TypesSupported" Type="integer" Value="7"/>
</RegistryKey>
</Component>

<Component Id="NetHost" Guid="f86c7a76-a437-4059-9962-c1de6267e961" Win64="$(var.IsWin64)">
<File Id="NetHostDll"
Name="nethost.dll"
Source="$(var.NetHostProgramFilesTargetPath)"
DiskId="1"
Vital="yes">
</File>
<RemoveFile Id="NetHostDll_Remove" Name="nethost.dll" On="install" />
</Component>
<Directory Id="HandlerVersionDir" Name="$(var.ANCMFolderVersion)" >
<Component Id="AspNetCoreModuleHandler" Guid="4b62060a-deb8-4de3-9557-9c0be21dc844" Win64="$(var.IsWin64)">
Expand Down Expand Up @@ -200,6 +212,16 @@
<RegistryValue Name="TypesSupported" Type="integer" Value="7"/>
</RegistryKey>
</Component>

<Component Id="NetHost.wow" Guid="564a522e-c9cc-4f47-b641-9bbb7797fc36" Win64="no">
<File Id="NetHostDll.wow"
Name="nethost.dll"
Source="$(var.NetHost32bit)"
DiskId="1"
Vital="yes">
</File>
<RemoveFile Id="NetHostDll.wow_Remove" Name="nethost.dll" On="install" />
</Component>
<Directory Id="HandlerVersionDir32" Name="$(var.ANCMFolderVersion)" SourceName="WowOnly">
<Component Id="AspNetCoreModuleHandler.wow" Guid="d927e5d3-c8b2-400c-b85c-ae5c2772d6c3" Win64="no">
<File Id="AspNetCoreModuleHandlerDll.wow"
Expand All @@ -221,11 +243,13 @@
<Feature Id="AspNetCoreModuleFeature" Title="!(loc.AspNetCoreModuleProductTitle)" Description="!(loc.AspNetCoreModuleProductDescription)" Level="1">
<ComponentRef Id="C_DiscoverabilityKey"/>
<ComponentRef Id="AspNetCoreModuleV2"/>
<ComponentRef Id="NetHost"/>
<ComponentRef Id="AspNetCoreModuleHandler"/>
<ComponentRef Id="AspNetCoreSchemaV2"/>
<?if $(var.Platform) = "x64" ?>
<ComponentRef Id="C_DiscoverabilityKeyWow"/>
<ComponentRef Id="AspNetCoreModuleV2.wow"/>
<ComponentRef Id="NetHost.wow"/>
<ComponentRef Id="AspNetCoreModuleHandler.wow"/>
<?endif ?>
</Feature>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
<DefineConstants>
AspNetCoreSchemaPath=$(_ServerIISBasePath)AspNetCoreModuleV2\AspNetCore\aspnetcore_schema_v2.xml;
AspNetCoreMofPath=$(_ServerIISBasePath)AspNetCoreModuleV2\AspNetCore\ancm.mof;
NetHost64bit=$(Pkgruntime_win-x64_Microsoft_NETCore_DotNetAppHost)\runtimes\win-x64\native\nethost.dll;
NetHost32bit=$(Pkgruntime_win-x86_Microsoft_NETCore_DotNetAppHost)\runtimes\win-x86\native\nethost.dll;
$(DefineConstants)
</DefineConstants>
</PropertyGroup>
Expand Down Expand Up @@ -70,5 +72,7 @@
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<SetPlatform>Platform=Win32</SetPlatform>
</ProjectReference>
<PackageReference Include="runtime.win-x64.Microsoft.NETCore.DotNetAppHost" Version="$(MicrosoftNetCoreDotNetAppHostPackageVersion)" GeneratePathProperty="true" />
<PackageReference Include="runtime.win-x86.Microsoft.NETCore.DotNetAppHost" Version="$(MicrosoftNetCoreDotNetAppHostPackageVersion)" GeneratePathProperty="true" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ HandlerResolver::LoadRequestHandlerAssembly(const IHttpApplication &pApplication
pApplication.GetApplicationPhysicalPath(),
pConfiguration.QueryArguments(),
errorContext,
m_hModule,
options));

location = options->GetDotnetExeLocation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ HRESULT HostFxrResolutionResult::Create(
_In_ const std::wstring& pcwzApplicationPhysicalPath,
_In_ const std::wstring& pcwzArguments,
_In_ ErrorContext& errorContext,
_In_ HMODULE aspNetCoreModule,
_Out_ std::unique_ptr<HostFxrResolutionResult>& ppWrapper)
{
std::filesystem::path knownDotnetLocation;
Expand All @@ -44,7 +45,8 @@ HRESULT HostFxrResolutionResult::Create(
hostFxrDllPath,
knownDotnetLocation,
arguments,
errorContext);
errorContext,
aspNetCoreModule);

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++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class HostFxrResolutionResult
_In_ const std::wstring& pcwzApplicationPhysicalPath,
_In_ const std::wstring& pcwzArguments,
_In_ ErrorContext& errorContext,
_In_ HMODULE aspNetCoreModule,
_Out_ std::unique_ptr<HostFxrResolutionResult>& ppWrapper);

private:
Expand Down
Loading