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

Only build the target platform in native projs for the VMR #60910

Merged
merged 1 commit into from
Mar 17, 2025
Merged
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
7 changes: 7 additions & 0 deletions eng/Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@
$(RepoRoot)src\SignalR\perf\benchmarkapps\**\*.csproj;
" />

<!-- In the VMR, we don't build the native ANCM bits in pass 1 -->
<ProjectToExclude Include="
$(RepoRoot)src\Installers\**\*.vcxproj;
"
Condition=" '$(BuildNative)' == 'true' and '$(DotNetBuild)' == 'true' and ('$(DotNetBuildPass)' == '' or '$(DotNetBuildPass)' == '1') " />


<!-- This project requires inputs from x64, x86, and arm64 on Windows - therefore in the VMR, we build it in pass 2 -->
<ProjectToExclude Include="
$(RepoRoot)src\Servers\IIS/IntegrationTesting.IIS\src\Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj;
Expand Down
4 changes: 4 additions & 0 deletions eng/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
<TargetOsName Condition=" '$(TargetOsName)' == '' AND $([MSBuild]::IsOSPlatform('OSX'))">osx</TargetOsName>
<TargetOsName Condition=" '$(TargetOsName)' == '' AND $([MSBuild]::IsOSPlatform('Linux'))">linux</TargetOsName>
<TargetOsName Condition=" '$(TargetOsName)' == '' AND $([MSBuild]::IsOSPlatform('FreeBSD'))">freebsd</TargetOsName>

<TargetArchitecture Condition="'$(TargetArchitecture)' == ''">x64</TargetArchitecture>
<NativePlatform>$(TargetArchitecture)</NativePlatform>
<NativePlatform Condition=" '$(NativePlatform)' == 'x86' ">Win32</NativePlatform>

<TargetRuntimeIdentifier Condition="'$(TargetRuntimeIdentifier)' == ''">$(TargetOsName)-$(TargetArchitecture)</TargetRuntimeIdentifier>
<PortableBuild Condition="'$(PortableBuild)' == ''">true</PortableBuild>
<DefaultAppHostRuntimeIdentifier Condition=" '$(DotNetBuild)' == 'true' ">$(TargetRuntimeIdentifier)</DefaultAppHostRuntimeIdentifier>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@
</Target>

<!-- Add native dependencies to the package when required. -->
<PropertyGroup>
<NativePlatform>$(TargetArchitecture)</NativePlatform>
<NativePlatform Condition=" '$(NativePlatform)' == 'x86' ">Win32</NativePlatform>
</PropertyGroup>
<ItemGroup>
<ProjectReference Condition=" '$(UseIisNativeAssets)' == 'true' AND $(BuildNative) AND '$(MSBuildRestoreSessionId)' == ''"
Include="$(RepoRoot)src\Servers\IIS\AspNetCoreModuleV2\InProcessRequestHandler\InProcessRequestHandler.vcxproj">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@
</ItemGroup>

<!-- Add native dependencies to the package when required. -->
<PropertyGroup>
<NativePlatform>$(TargetArchitecture)</NativePlatform>
<NativePlatform Condition=" '$(NativePlatform)' == 'x86' ">Win32</NativePlatform>
</PropertyGroup>
<ItemGroup>
<ProjectReference Condition=" '$(UseIisNativeAssets)' == 'true' AND $(BuildNative) AND '$(MSBuildRestoreSessionId)' == ''"
Include="$(RepoRoot)src\Servers\IIS\AspNetCoreModuleV2\InProcessRequestHandler\InProcessRequestHandler.vcxproj">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,52 +265,6 @@
</Component>
</Directory>
</Directory>

<!-- WOW64 Support -->
<?if $(var.Platform) != "x86" ?>
<Directory Id="$(var.ProgramFilesFolder32)">
<Directory Id="INSTALLDIR32" Name="IIS Express" >
<Directory Id="INSTALLLOCATION32" ShortName="ANCM" Name="$(var.ProductName)">
<Directory Id="VersionDir32" Name="$(var.ProductVersionString)">
<!-- Originally created with same component GUID as IIS installer. Must remain the same so upgrade doesn't remove this file -->
<Component Id="AspNetCoreModule.wow" Guid="45ba5011-a619-4d06-8a8d-155b1f9732b3" Win64="no">
<File Id="AspNetCoreModuleDll.wow"
Name="aspnetcorev2.dll"
Source="$(var.ArtifactsDir)\bin\AspNetCoreModuleShim\Win32\$(var.Configuration)\aspnetcorev2.dll"
DiskId="1"
Vital="yes">
</File>
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\$(var.ProductShortName)">
<RegistryValue Name="EventMessageFile" Type="expandable" Value="[#AspNetCoreModuleDll.wow]"/>
<RegistryValue Name="TypesSupported" Type="integer" Value="7"/>
</RegistryKey>
</Component>
<Directory Id="HandlerVersionDir32" Name="$(var.ANCMFolderVersion)" >
<Component Id="AspNetCoreModuleHandler.wow" Guid="0A8EDB50-7D85-4825-8010-D27EFAF061B6" Win64="no">
<File Id="AspNetCoreModuleHandlerDll.wow"
Name="aspnetcorev2_outofprocess.dll"
Source="$(var.ArtifactsDir)\bin\OutOfProcessRequestHandler\Win32\$(var.Configuration)\aspnetcorev2_outofprocess.dll"
DiskId="1"
Vital="yes">
</File>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="IISConfigDir.wow" Name="config">
<Directory Id="IISSchemaDir.wow" Name="schema">
<Component Id="AspNetCoreSchema.wow" Guid="$(var.SchemaGuid32)" Win64="no" >
<File Id="AspNetCoreSchemaFile.wow"
Name="aspnetcore_schema_v2.xml"
Source="$(var.AspNetCoreSchemaPath)"
DiskId="1"
Vital="yes"/>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<?endif?>
</DirectoryRef>

<!-- Feature Definition -->
Expand All @@ -324,11 +278,6 @@
<ComponentRef Id="AspNetCoreModuleHandler.arm64" />
<?endif ?>
<ComponentRef Id="AspNetCoreSchema"/>
<?if $(var.Platform) != "x86" ?>
<ComponentRef Id="AspNetCoreModule.wow"/>
<ComponentRef Id="AspNetCoreModuleHandler.wow"/>
<ComponentRef Id="AspNetCoreSchema.wow"/>
<?endif ?>
</Feature>

<!-- User Interface -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="'$(BuildNative)' == 'true'">
<ItemGroup Condition="'$(BuildNative)' == 'true' AND ('$(DotNetBuild)' != 'true' OR '$(DotNetBuildPass)' == '2') ">
<ProjectReference Include="$(_ServerIISBasePath)AspNetCoreModuleV2\AspNetCore\AspNetCore.vcxproj">
<Name>AspNetCoreV2</Name>
<Private>True</Private>
Expand Down Expand Up @@ -87,6 +87,23 @@
</ProjectReference>
</ItemGroup>

<ItemGroup Condition="'$(BuildNative)' == 'true' AND '$(DotNetBuild)' == 'true' AND '$(DotNetBuildPass)' != '2' ">
<ProjectReference Include="$(_ServerIISBasePath)AspNetCoreModuleV2\AspNetCore\AspNetCore.vcxproj">
<Name>AspNetCoreV2</Name>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<SetPlatform>Platform=$(NativePlatform)</SetPlatform>
</ProjectReference>
<ProjectReference Include="$(_ServerIISBasePath)AspNetCoreModuleV2\OutOfProcessRequestHandler\OutOfProcessRequestHandler.vcxproj">
<Name>AspNetCoreV2Handler</Name>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<SetPlatform>Platform=$(NativePlatform)</SetPlatform>
</ProjectReference>
</ItemGroup>

<Target Name="CopyANCM" BeforeTargets="_PrepareForBuild" Condition=" '$(BuildNative)' != 'true' ">
<ItemGroup>
<None Include="%(RunShimComponents.DllLocation)" CopyToOutputDirectory="PreserveNewest" Condition="Exists('%(RunShimComponents.DllLocation)')" Link="%(RunShimComponents.Platform)\%(RunShimComponents.NativeAsset).dll" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@
</Target>

<ItemGroup Condition=" '$(UseIisNativeAssets)' == 'true' ">
<NativeProjectReference Include="$(MSBuildThisFileDirectory)..\..\AspNetCoreModuleV2\InProcessRequestHandler\InProcessRequestHandler.vcxproj" Platform="x64" />
<NativeProjectReference Include="$(MSBuildThisFileDirectory)..\..\AspNetCoreModuleV2\InProcessRequestHandler\InProcessRequestHandler.vcxproj" Platform="Win32" />
<NativeProjectReference Include="$(MSBuildThisFileDirectory)..\..\AspNetCoreModuleV2\InProcessRequestHandler\InProcessRequestHandler.vcxproj" Platform="ARM64" />
<!-- Only build the target platform for product build (DotNetBuild=true). -->
<NativeProjectReference Include="$(MSBuildThisFileDirectory)..\..\AspNetCoreModuleV2\InProcessRequestHandler\InProcessRequestHandler.vcxproj" Platform="x64" Condition="'$(DotNetBuild)' != 'true'" />
<NativeProjectReference Include="$(MSBuildThisFileDirectory)..\..\AspNetCoreModuleV2\InProcessRequestHandler\InProcessRequestHandler.vcxproj" Platform="Win32" Condition="'$(DotNetBuild)' != 'true'" />
<NativeProjectReference Include="$(MSBuildThisFileDirectory)..\..\AspNetCoreModuleV2\InProcessRequestHandler\InProcessRequestHandler.vcxproj" Platform="ARM64" Condition="'$(DotNetBuild)' != 'true'" />
<NativeProjectReference Include="$(MSBuildThisFileDirectory)..\..\AspNetCoreModuleV2\InProcessRequestHandler\InProcessRequestHandler.vcxproj" Platform="$(NativePlatform)" Condition="'$(DotNetBuild)' == 'true'" />

<UpToDateCheckInput Include="$(AspNetCoreModuleV2InProcessHandlerDll)" />
</ItemGroup>
Expand Down