Skip to content

Fix ASP.NET Core module installer upgrade issues #60769

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

Merged
merged 2 commits into from
Mar 13, 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
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,63 @@
<DirectoryRef Id="INSTALLDIR">
<Directory Id="INSTALLLOCATION" ShortName="ANCM" Name="$(var.ProductName)">
<Directory Id="VersionDir" Name="$(var.ProductVersionString)">
<?if $(var.Platform) = "arm64" ?>
<Component Id="AspNetCoreModuleV2.forwarder"
Guid="08968573-05c1-4bf1-8879-7b818ac9525b"
Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleV2Dll.forwarder"
<Component Id="AspNetCoreModule" Guid="84ed6ce6-c8a3-4fa8-a872-c98a1d15dd4f" Win64="$(var.IsWin64)">
<?if $(var.Platform) = "arm64" ?>
<File Id="AspNetCoreModuleDll"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should consider setting the File@KeyPath="yes". If child elements of a component do not have a keypath set, and the parent directory of the component is not a key path, then the first child is selected. In this case, it would be the file. However, if you modify the order, the key path will change. Setting it explicitly will avoid issues in the future.

This might be a good read: https://learn.microsoft.com/en-us/windows/win32/msi/what-happens-if-the-component-rules-are-broken

Name="aspnetcorev2.dll"
Source="$(var.ArtifactsDir)\bin\AspNetCoreModuleForwarders\aspnetcorev2.dll"
DiskId="1"
Vital="yes"/>
<RegistryKey Root="HKLM"
Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\$(var.ProductShortName)">
<RegistryValue Name="EventMessageFile" Type="expandable"
Value="[#AspNetCoreModuleV2Dll.forwarder]" />
<RegistryValue Name="TypesSupported" Type="integer" Value="7" />
</RegistryKey>
<?else ?>
<File Id="AspNetCoreModuleDll"
Name="aspnetcorev2.dll"
Source="$(var.AspNetCoreV2ProgramFilesTargetPath)"
DiskId="1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File@DiskId="1" and File@Vital="yes" are the defaults, there are probably more of these to clean up

Vital="yes"/>
<?endif ?>
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\$(var.ProductShortName)">
Copy link
Member

@joeloff joeloff Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The general rule for components is one file/reg key per component. When performing repairs, the keypath of the component is used to determine its state and whether it needs to be reinstalled during a repair. If non-keypath items are missing or damaged, repairs my not necessarily work. It's likely repair will write the registry keys again since WiX by default will set the reinstall mode to include registry keys. Just calling it out in case this is an issue.

<RegistryValue Name="EventMessageFile" Type="expandable" Value="[#AspNetCoreModuleDll]"/>
<RegistryValue Name="TypesSupported" Type="integer" Value="7"/>
</RegistryKey>
</Component>
<Directory Id="HandlerVersionDir" Name="$(var.ANCMFolderVersion)" >
<Component Id="AspNetCoreModuleHandler" Guid="559EF726-B25C-480F-AFA4-32D0BA8B2376" Win64="$(var.IsWin64)">
<?if $(var.Platform) = "arm64" ?>
<File Id="AspNetCoreModuleHandlerDll"
Name="aspnetcorev2_outofprocess.dll"
Source="$(var.ArtifactsDir)\bin\AspNetCoreModuleForwarders\aspnetcorev2_outofprocess.dll"
DiskId="1"
Vital="yes"/>
<?else ?>
<File Id="AspNetCoreModuleHandlerDll"
Name="aspnetcorev2_outofprocess.dll"
Source="$(var.AspNetCoreV2HandlerProgramFilesTargetPath)"
DiskId="1"
Vital="yes">
</File>
<?endif ?>
</Component>
<?if $(var.Platform) = "arm64" ?>
<Component Id="AspNetCoreModuleHandler.x64"
Guid="0b192457-9c6a-4703-ba6a-0c5a58b7c9cb"
Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleHandlerDll.x64"
Name="aspnetcorev2_outofprocess_x64.dll"
Source="$(var.ArtifactsDir)\bin\OutOfProcessRequestHandler\x64\$(var.Configuration)\aspnetcorev2_outofprocess.dll"
DiskId="1"
Vital="yes"/>
</Component>
<Component Id="AspNetCoreModuleHandler.arm64"
Guid="21cc9da0-ab0a-4717-90df-dbaaa3f68510" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleHandlerDll.arm64"
Name="aspnetcorev2_outofprocess_arm64.dll"
Source="$(var.AspNetCoreV2HandlerProgramFilesTargetPath)"
DiskId="1"
Vital="yes"/>
</Component>
<?endif ?>
</Directory>
<?if $(var.Platform) = "arm64" ?>
<Component Id="AspNetCoreModuleV2.x64"
Guid="1962b1b0-6345-4b37-97b3-a8f2c9e82bee"
Win64="$(var.IsWin64)">
Expand Down Expand Up @@ -210,56 +251,6 @@
<RegistryValue Name="TypesSupported" Type="integer" Value="7" />
</RegistryKey>
</Component>
<Directory Id="HandlerVersionDir" Name="$(var.ANCMFolderVersion)">
<Component Id="AspNetCoreModuleHandler.forwarder"
Guid="51045d90-7231-480c-bac7-2969a2861ece" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleHandlerDll.forwarder"
Name="aspnetcorev2_outofprocess.dll"
Source="$(var.ArtifactsDir)\bin\AspNetCoreModuleForwarders\aspnetcorev2_outofprocess.dll"
DiskId="1"
Vital="yes"/>
</Component>
<Component Id="AspNetCoreModuleHandler.x64"
Guid="0b192457-9c6a-4703-ba6a-0c5a58b7c9cb"
Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleHandlerDll.x64"
Name="aspnetcorev2_outofprocess_x64.dll"
Source="$(var.ArtifactsDir)\bin\OutOfProcessRequestHandler\x64\$(var.Configuration)\aspnetcorev2_outofprocess.dll"
DiskId="1"
Vital="yes"/>
</Component>
<Component Id="AspNetCoreModuleHandler.arm64"
Guid="21cc9da0-ab0a-4717-90df-dbaaa3f68510" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleHandlerDll.arm64"
Name="aspnetcorev2_outofprocess_arm64.dll"
Source="$(var.AspNetCoreV2HandlerProgramFilesTargetPath)"
DiskId="1"
Vital="yes"/>
</Component>
</Directory>
<?else ?>
<Component Id="AspNetCoreModule" Guid="84ed6ce6-c8a3-4fa8-a872-c98a1d15dd4f" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleDll"
Name="aspnetcorev2.dll"
Source="$(var.AspNetCoreV2ProgramFilesTargetPath)"
DiskId="1"
Vital="yes">
</File>
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\$(var.ProductShortName)">
<RegistryValue Name="EventMessageFile" Type="expandable" Value="[#AspNetCoreModuleDll]"/>
<RegistryValue Name="TypesSupported" Type="integer" Value="7"/>
</RegistryKey>
</Component>
<Directory Id="HandlerVersionDir" Name="$(var.ANCMFolderVersion)" >
<Component Id="AspNetCoreModuleHandler" Guid="559EF726-B25C-480F-AFA4-32D0BA8B2376" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleHandlerDll"
Name="aspnetcorev2_outofprocess.dll"
Source="$(var.AspNetCoreV2HandlerProgramFilesTargetPath)"
DiskId="1"
Vital="yes">
</File>
</Component>
</Directory>
<?endif ?>
</Directory>
</Directory>
Expand Down Expand Up @@ -324,16 +315,13 @@

<!-- Feature Definition -->
<Feature Id="AspNetCoreModuleFeature" Title="!(loc.AspNetCoreModuleProductTitle)" Description="!(loc.AspNetCoreModuleProductDescription)" Level="1">
<ComponentRef Id="AspNetCoreModule"/>
<ComponentRef Id="AspNetCoreModuleHandler"/>
<?if $(var.Platform) = "arm64" ?>
<ComponentRef Id="AspNetCoreModuleV2.forwarder" />
<ComponentRef Id="AspNetCoreModuleHandler.forwarder" />
<ComponentRef Id="AspNetCoreModuleV2.x64" />
<ComponentRef Id="AspNetCoreModuleHandler.x64" />
<ComponentRef Id="AspNetCoreModuleV2.arm64" />
<ComponentRef Id="AspNetCoreModuleHandler.arm64" />
<?else ?>
<ComponentRef Id="AspNetCoreModule"/>
<ComponentRef Id="AspNetCoreModuleHandler"/>
<?endif ?>
<ComponentRef Id="AspNetCoreSchema"/>
<?if $(var.Platform) != "x86" ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,62 @@
<Directory Id="IISModuleDirectory" Name="IIS">
<Directory Id="INSTALLLOCATION" ShortName="ANCM" Name="Asp.Net Core Module">
<Directory Id="VersionDir" Name="$(var.ProductVersionString)">
<?if $(var.Platform) = "arm64" ?>
<Component Id="AspNetCoreModuleV2.forwarder" Guid="4b6bb33a-01f0-48c7-bce9-5a5514ac0431" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleV2Dll.forwarder"
<Component Id="AspNetCoreModuleV2" Guid="3a692941-59be-43cf-98a8-6ed01b12a519" Win64="$(var.IsWin64)">
<?if $(var.Platform) = "arm64" ?>
<File Id="AspNetCoreModuleV2Dll"
Name="aspnetcorev2.dll"
Source="$(var.ArtifactsDir)\bin\AspNetCoreModuleForwarders\aspnetcorev2.dll"
DiskId="1"
Vital="yes">
</File>
<RemoveFile Id="AspNetCoreModuleV2Dll_Remove.forwarder" Name="aspnetcorev2.dll" On="install" />
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\$(var.ProductShortName)">
<RegistryValue Name="EventMessageFile" Type="expandable" Value="[#AspNetCoreModuleV2Dll.forwarder]"/>
<RegistryValue Name="TypesSupported" Type="integer" Value="7"/>
</RegistryKey>
Vital="yes"/>
<?else ?>
<File Id="AspNetCoreModuleV2Dll"
Name="aspnetcorev2.dll"
Source="$(var.AspNetCoreV2ProgramFilesTargetPath)"
DiskId="1"
Vital="yes"/>
<?endif ?>
<RemoveFile Id="AspNetCoreModuleV2Dll_Remove" Name="aspnetcorev2.dll" On="install" />
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\$(var.ProductShortName)">
<RegistryValue Name="EventMessageFile" Type="expandable" Value="[#AspNetCoreModuleV2Dll]"/>
<RegistryValue Name="TypesSupported" Type="integer" Value="7"/>
</RegistryKey>
</Component>
<Directory Id="HandlerVersionDir" Name="$(var.ANCMFolderVersion)" >
<Component Id="AspNetCoreModuleHandler" Guid="4b62060a-deb8-4de3-9557-9c0be21dc844" Win64="$(var.IsWin64)">
<?if $(var.Platform) = "arm64" ?>
<File Id="AspNetCoreModuleHandlerDll"
Name="aspnetcorev2_outofprocess.dll"
Source="$(var.ArtifactsDir)\bin\AspNetCoreModuleForwarders\aspnetcorev2_outofprocess.dll"
DiskId="1"
Vital="yes"/>
<?else ?>
<File Id="AspNetCoreModuleHandlerDll"
Name="aspnetcorev2_outofprocess.dll"
Source="$(var.AspNetCoreV2HandlerProgramFilesTargetPath)"
DiskId="1"
Vital="yes"/>
<?endif ?>
</Component>
<?if $(var.Platform) = "arm64" ?>
<Component Id="AspNetCoreModuleHandler.x64" Guid="d9b0b5c9-8bbe-46f2-97d5-ba23d1a1ffed" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleHandlerDll.x64"
Name="aspnetcorev2_outofprocess_x64.dll"
Source="$(var.ArtifactsDir)\bin\OutOfProcessRequestHandler\x64\$(var.Configuration)\aspnetcorev2_outofprocess.dll"
DiskId="1"
Vital="yes">
</File>
</Component>
<Component Id="AspNetCoreModuleHandler.arm64" Guid="ab249ab5-9203-4fd5-87b6-8acc3e1a0702" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleHandlerDll.arm64"
Name="aspnetcorev2_outofprocess_arm64.dll"
Source="$(var.AspNetCoreV2HandlerProgramFilesTargetPath)"
DiskId="1"
Vital="yes">
</File>
</Component>
<?endif ?>
</Directory>
<?if $(var.Platform) = "arm64" ?>
<Component Id="AspNetCoreModuleV2.x64" Guid="325cf239-162d-4de8-97e7-642e6c66181c" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleV2Dll.x64"
Name="aspnetcorev2_x64.dll"
Expand All @@ -184,54 +226,6 @@
<RegistryValue Name="TypesSupported" Type="integer" Value="7"/>
</RegistryKey>
</Component>
<Directory Id="HandlerVersionDir" Name="$(var.ANCMFolderVersion)" >
<Component Id="AspNetCoreModuleHandler.forwarder" Guid="4862728c-e943-49f0-901a-cd96e4bf03ef" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleHandlerDll.forwarder"
Name="aspnetcorev2_outofprocess.dll"
Source="$(var.ArtifactsDir)\bin\AspNetCoreModuleForwarders\aspnetcorev2_outofprocess.dll"
DiskId="1"
Vital="yes">
</File>
</Component>
<Component Id="AspNetCoreModuleHandler.x64" Guid="d9b0b5c9-8bbe-46f2-97d5-ba23d1a1ffed" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleHandlerDll.x64"
Name="aspnetcorev2_outofprocess_x64.dll"
Source="$(var.ArtifactsDir)\bin\OutOfProcessRequestHandler\x64\$(var.Configuration)\aspnetcorev2_outofprocess.dll"
DiskId="1"
Vital="yes">
</File>
</Component>
<Component Id="AspNetCoreModuleHandler.arm64" Guid="ab249ab5-9203-4fd5-87b6-8acc3e1a0702" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleHandlerDll.arm64"
Name="aspnetcorev2_outofprocess_arm64.dll"
Source="$(var.AspNetCoreV2HandlerProgramFilesTargetPath)"
DiskId="1"
Vital="yes">
</File>
</Component>
</Directory>
<?else ?>
<Component Id="AspNetCoreModuleV2" Guid="3a692941-59be-43cf-98a8-6ed01b12a519" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleV2Dll"
Name="aspnetcorev2.dll"
Source="$(var.AspNetCoreV2ProgramFilesTargetPath)"
DiskId="1"
Vital="yes"/>
<RemoveFile Id="AspNetCoreModuleV2Dll_Remove" Name="aspnetcorev2.dll" On="install" />
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\$(var.ProductShortName)">
<RegistryValue Name="EventMessageFile" Type="expandable" Value="[#AspNetCoreModuleV2Dll]"/>
<RegistryValue Name="TypesSupported" Type="integer" Value="7"/>
</RegistryKey>
</Component>
<Directory Id="HandlerVersionDir" Name="$(var.ANCMFolderVersion)" >
<Component Id="AspNetCoreModuleHandler" Guid="4b62060a-deb8-4de3-9557-9c0be21dc844" Win64="$(var.IsWin64)">
<File Id="AspNetCoreModuleHandlerDll"
Name="aspnetcorev2_outofprocess.dll"
Source="$(var.AspNetCoreV2HandlerProgramFilesTargetPath)"
DiskId="1"
Vital="yes"/>
</Component>
</Directory>
<?endif ?>
</Directory>
</Directory>
Expand Down Expand Up @@ -287,16 +281,13 @@
<Feature Id="AspNetCoreModuleFeature" Title="!(loc.AspNetCoreModuleProductTitle)" Description="!(loc.AspNetCoreModuleProductDescription)" Level="1">
<ComponentRef Id="C_DiscoverabilityKey"/>
<ComponentRef Id="AspNetCoreSchemaV2"/>
<ComponentRef Id="AspNetCoreModuleV2" />
<ComponentRef Id="AspNetCoreModuleHandler" />
<?if $(var.Platform) = "arm64"?>
<ComponentRef Id="AspNetCoreModuleV2.forwarder"/>
<ComponentRef Id="AspNetCoreModuleHandler.forwarder"/>
<ComponentRef Id="AspNetCoreModuleV2.x64"/>
<ComponentRef Id="AspNetCoreModuleHandler.x64"/>
<ComponentRef Id="AspNetCoreModuleV2.arm64"/>
<ComponentRef Id="AspNetCoreModuleHandler.arm64"/>
<?else ?>
<ComponentRef Id="AspNetCoreModuleV2" />
<ComponentRef Id="AspNetCoreModuleHandler" />
<?endif ?>
<?if $(var.Platform) != "x86" ?>
<ComponentRef Id="C_DiscoverabilityKeyWow"/>
Expand All @@ -323,11 +314,7 @@
<CustomTable Id="IISGlobalModule">
<Row>
<Data Column="Name">AspNetCoreModuleV2</Data>
<?if $(var.Platform) = "arm64" ?>
<Data Column="File_">AspNetCoreModuleV2Dll.forwarder</Data>
<?else ?>
<Data Column="File_">AspNetCoreModuleV2Dll</Data>
<?endif ?>
</Row>
</CustomTable>

Expand All @@ -347,11 +334,7 @@
<Data Column="AreaName">ANCM</Data>
<Data Column="AreaValue">65536</Data>
<Data Column="BinaryName_">AncmMofFile</Data>
<?if $(var.Platform) = "arm64" ?>
<Data Column="Component_">AspNetCoreModuleV2.forwarder</Data>
<?else ?>
<Data Column="Component_">AspNetCoreModuleV2</Data>
<?endif ?>
</Row>
</CustomTable>
<!-- <?endif ?> -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
call %1 -host_arch=x64 -arch=arm64 -no_logo
call build.cmd %2 %3
call build.cmd %2 %3 %4
Loading
Loading