diff --git a/eng/PatchConfig.props b/eng/PatchConfig.props index dd96236f282246484a4f473be0152218bd41c500..319d85992f5c41cf08c2193c1228b0acb460839f 100644 --- a/eng/PatchConfig.props +++ b/eng/PatchConfig.props @@ -51,6 +51,8 @@ Later on, this will be checked using this condition: </PropertyGroup> <PropertyGroup Condition=" '$(VersionPrefix)' == '2.2.5' "> <PackagesInPatch> + Microsoft.AspNetCore.AspNetCoreModule; + Microsoft.AspNetCore.AspNetCoreModuleV2; </PackagesInPatch> </PropertyGroup> diff --git a/src/Installers/Windows/AspNetCoreModule-Setup/.gitignore b/src/Installers/Windows/AspNetCoreModule-Setup/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..06d8a1a8148d7bc03eead1fd6267ee258926df90 --- /dev/null +++ b/src/Installers/Windows/AspNetCoreModule-Setup/.gitignore @@ -0,0 +1,3 @@ +Debug/ +Win32/ +x64/ diff --git a/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV1/ancm_iis_express.wxs b/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV1/ancm_iis_express.wxs index 00a8af36cf69ae7640bdc0b17369d25823b75836..6c60fedb04f8c1b822bc6e6cc48a0e1bcf169acc 100644 --- a/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV1/ancm_iis_express.wxs +++ b/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV1/ancm_iis_express.wxs @@ -348,66 +348,26 @@ Value=""[IISEXPRESS_INSTALL_PATH]appcmd.exe" set config -section:system.webServer/httpCompression /+"dynamicTypes.[\[]mimeType='text/event-stream',enabled='FALSE'[\]]" /apphostconfig:"[IISEXPRESS_APPHOST_CONFIG_TMP]""/> <CustomAction Id="CA_UPDATE_DYNAMIC_COMPRESSION_TMP" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/> - <!-- CA to add config section to applicationhost.config --> + <CustomAction Id="CA_ADD_CONFIGSECTION_PROPERTY" Property="CA_ADD_CONFIGSECTION" - Value="[IISEXPRESS_APPHOST_CONFIG];[IISEXPRESS_APPHOST_CONFIG_TMP]"/> - <CustomAction Id="CA_ADD_CONFIGSECTION" Script="jscript" Execute="deferred" Return="check" Impersonate="no"> - <![CDATA[ - var caData = Session.Property("CustomActionData"); - configfiles = caData.split(';'); - for (var i = 0; i < configfiles.length; i++) { - var configfile = configfiles[i]; - var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); - xmlDoc.async = false; - xmlDoc.preserveWhiteSpace = true; - xmlDoc.load(configfile ); - if (xmlDoc.parseError.errorCode == 0) { - xmlDoc.setProperty("SelectionLanguage", "XPath"); - var websvrNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]"); - if (websvrNode != null) { - var ancmNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]/section[@name=\"$(var.AspNetCoreSectionName)\"]"); - if (ancmNode == null) { - ancmNode = xmlDoc.createElement("section"); - ancmNode.setAttribute("name", "$(var.AspNetCoreSectionName)"); - ancmNode.setAttribute("overrideModeDefault", "Allow"); - websvrNode.appendChild(ancmNode); - xmlDoc.save(configfile ); - } - } - } - } - ]]> - </CustomAction> - - <!-- CA to remove config section to applicationhost.config --> + Value="[IISEXPRESS_APPHOST_CONFIG]"/> + <CustomAction BinaryKey="IISCustomActionDll" Id="CA_ADD_CONFIGSECTION" DllEntry="AddConfigSection" Execute="deferred" Return="check" Impersonate="no"/> + + <CustomAction Id="CA_ADD_CONFIGSECTION_PROPERTY_TMP" + Property="CA_ADD_CONFIGSECTION_TMP" + Value="[IISEXPRESS_APPHOST_CONFIG_TMP]"/> + <CustomAction BinaryKey="IISCustomActionDll" Id="CA_ADD_CONFIGSECTION_TMP" DllEntry="AddConfigSection" Execute="deferred" Return="check" Impersonate="no"/> + <CustomAction Id="CA_REMOVE_CONFIGSECTION_PROPERTY" - Property="CA_REMOVE_CONFIGSECTION" - Value="[IISEXPRESS_APPHOST_CONFIG];[IISEXPRESS_APPHOST_CONFIG_TMP]"/> - <CustomAction Id="CA_REMOVE_CONFIGSECTION" Script="jscript" Execute="deferred" Return="check" Impersonate="no"> - <![CDATA[ - var caData = Session.Property("CustomActionData"); - configfiles = caData.split(';'); - for (var i = 0; i < configfiles.length; i++) { - var configfile = configfiles[i]; - var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); - xmlDoc.async = false; - xmlDoc.preserveWhiteSpace = true; - xmlDoc.load(configfile ); - if (xmlDoc.parseError.errorCode == 0) { - xmlDoc.setProperty("SelectionLanguage", "XPath"); - var websvrNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]"); - if (websvrNode != null) { - var ancmNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]/section[@name=\"$(var.AspNetCoreSectionName)\"]"); - if (ancmNode != null) { - websvrNode.removeChild(ancmNode); - xmlDoc.save(configfile ); - } - } - } - } - ]]> - </CustomAction> + Property="CA_REMOVE_CONFIGSECTION" + Value="[IISEXPRESS_APPHOST_CONFIG]"/> + <CustomAction Id="CA_REMOVE_CONFIGSECTION" BinaryKey="IISCustomActionDll" DllEntry="RemoveConfigSection" Execute="deferred" Return="check" Impersonate="no" /> + + <CustomAction Id="CA_REMOVE_CONFIGSECTION_PROPERTY_TMP" + Property="CA_REMOVE_CONFIGSECTION_TMP" + Value="[IISEXPRESS_APPHOST_CONFIG_TMP]"/> + <CustomAction Id="CA_REMOVE_CONFIGSECTION_TMP" BinaryKey="IISCustomActionDll" DllEntry="RemoveConfigSection" Execute="deferred" Return="check" Impersonate="no" /> <?if $(var.Platform) = "x64" ?> <CustomAction Id="CA_UNLOCK_HANDLER32_PROPERTY" @@ -502,67 +462,25 @@ Value=""[IISEXPRESS_INSTALL_PATH32]appcmd.exe" set config -section:system.webServer/httpCompression /+"dynamicTypes.[\[]mimeType='text/event-stream',enabled='FALSE'[\]]" /apphostconfig:"[IISEXPRESS_APPHOST_CONFIG32]""/> <CustomAction Id="CA_UPDATE_DYNAMIC_COMPRESSION_TMP32" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/> - <!-- CA to add config section to applicationhost.config --> - <CustomAction Id="CA_ADD_CONFIGSECTION32_PROPERTY" - Property="CA_ADD_CONFIGSECTION32" - Value="[IISEXPRESS_APPHOST_CONFIG32];[IISEXPRESS_APPHOST_CONFIG_TMP32]"/> - <CustomAction Id="CA_ADD_CONFIGSECTION32" Script="jscript" Execute="deferred" Return="check" Impersonate="no"> - <!-- Warning LGHT1076: ICE03: String overflow. Orca.exe inspection shows the custom action value is populated correctly --> - <![CDATA[ - var caData = Session.Property("CustomActionData"); - configfiles = caData.split(';'); - for (var i = 0; i < configfiles.length; i++) { - var configfile = configfiles[i]; - var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); - xmlDoc.async = false; - xmlDoc.preserveWhiteSpace = true; - xmlDoc.load(configfile); - if (xmlDoc.parseError.errorCode == 0) { - xmlDoc.setProperty("SelectionLanguage", "XPath"); - var websvrNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]"); - if (websvrNode != null) { - var ancmNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]/section[@name=\"$(var.AspNetCoreSectionName)\"]"); - if (ancmNode == null) { - ancmNode = xmlDoc.createElement("section"); - ancmNode.setAttribute("name", "$(var.AspNetCoreSectionName)"); - ancmNode.setAttribute("overrideModeDefault", "Allow"); - websvrNode.appendChild(ancmNode); - xmlDoc.save(configfile); - } - } - } - } - ]]> - </CustomAction> - - <!-- CA to remove config section to applicationhost.config --> + <CustomAction Id="CA_ADD_CONFIGSECTION32_PROPERTY" + Property="CA_ADD_CONFIGSECTION32" + Value="[IISEXPRESS_APPHOST_CONFIG32]"/> + <CustomAction BinaryKey="IISCustomActionDll" Id="CA_ADD_CONFIGSECTION32" DllEntry="AddConfigSection" Execute="deferred" Return="check" Impersonate="no"/> + + <CustomAction Id="CA_ADD_CONFIGSECTION32_PROPERTY_TMP" + Property="CA_ADD_CONFIGSECTION32_TMP" + Value="[IISEXPRESS_APPHOST_CONFIG_TMP32]"/> + <CustomAction BinaryKey="IISCustomActionDll" Id="CA_ADD_CONFIGSECTION32_TMP" DllEntry="AddConfigSection" Execute="deferred" Return="check" Impersonate="no"/> + <CustomAction Id="CA_REMOVE_CONFIGSECTION32_PROPERTY" Property="CA_REMOVE_CONFIGSECTION32" - Value="[IISEXPRESS_APPHOST_CONFIG32];[IISEXPRESS_APPHOST_CONFIG_TMP32]"/> - <CustomAction Id="CA_REMOVE_CONFIGSECTION32" Script="jscript" Execute="deferred" Return="check" Impersonate="no"> - <![CDATA[ - var caData = Session.Property("CustomActionData"); - configfiles = caData.split(';'); - for (var i = 0; i < configfiles.length; i++) { - var configfile = configfiles[i]; - var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); - xmlDoc.async = false; - xmlDoc.preserveWhiteSpace = true; - xmlDoc.load(configfile); - if (xmlDoc.parseError.errorCode == 0) { - xmlDoc.setProperty("SelectionLanguage", "XPath"); - var websvrNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]"); - if (websvrNode != null) { - var ancmNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]/section[@name=\"$(var.AspNetCoreSectionName)\"]"); - if (ancmNode != null) { - websvrNode.removeChild(ancmNode); - xmlDoc.save(configfile); - } - } - } - } - ]]> - </CustomAction> + Value="[IISEXPRESS_APPHOST_CONFIG32]"/> + <CustomAction Id="CA_REMOVE_CONFIGSECTION32" BinaryKey="IISCustomActionDll" DllEntry="RemoveConfigSection" Execute="deferred" Return="check" Impersonate="no" /> + + <CustomAction Id="CA_REMOVE_CONFIGSECTION32_PROPERTY_TMP" + Property="CA_REMOVE_CONFIGSECTION32_TMP" + Value="[IISEXPRESS_APPHOST_CONFIG_TMP32]"/> + <CustomAction Id="CA_REMOVE_CONFIGSECTION32_TMP" BinaryKey="IISCustomActionDll" DllEntry="RemoveConfigSection" Execute="deferred" Return="check" Impersonate="no" /> <?endif?> <InstallExecuteSequence> @@ -581,6 +499,8 @@ <Custom Action="CA_SET_MODULE" After="CA_SET_MODULE_PROPERTY"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_CONFIGSECTION_PROPERTY" After="CA_SET_MODULE"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_CONFIGSECTION" After="CA_ADD_CONFIGSECTION_PROPERTY"><![CDATA[(NOT REMOVE)]]></Custom> + <Custom Action="CA_ADD_CONFIGSECTION_PROPERTY_TMP" After="CA_ADD_CONFIGSECTION"><![CDATA[(NOT REMOVE)]]></Custom> + <Custom Action="CA_ADD_CONFIGSECTION_TMP" After="CA_ADD_CONFIGSECTION_PROPERTY_TMP"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION_PROPERTY" After="CA_ADD_CONFIGSECTION"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION" After="CA_ADD_TRACE_PROVIDER_DEFINITION_PROPERTY"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION_TMP_PROPERTY" After="CA_ADD_TRACE_PROVIDER_DEFINITION"><![CDATA[(NOT REMOVE)]]></Custom> @@ -591,6 +511,8 @@ <Custom Action="CA_REMOVE_MODULE" Before="RemoveFiles"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_CONFIGSECTION_PROPERTY" Before="CA_REMOVE_CONFIGSECTION"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_CONFIGSECTION" Before="RemoveFiles"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> + <Custom Action="CA_REMOVE_CONFIGSECTION_PROPERTY_TMP" Before="CA_REMOVE_CONFIGSECTION_TMP"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> + <Custom Action="CA_REMOVE_CONFIGSECTION_TMP" Before="RemoveFiles"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_TRACE_PROVIDER_DEFINITION_PROPERTY" Before="CA_REMOVE_TRACE_PROVIDER_DEFINITION"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_TRACE_PROVIDER_DEFINITION" Before="RemoveFiles"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_TRACE_PROVIDER_DEFINITION_TMP_PROPERTY" Before="CA_REMOVE_TRACE_PROVIDER_DEFINITION_TMP"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> @@ -621,6 +543,8 @@ <Custom Action="CA_SET_MODULE32" After="CA_ADD_MODULE32_PROPERTY"><![CDATA[(NOT REMOVE AND IISEXPRESS_INSTALL_PATH32)]]></Custom> <Custom Action="CA_ADD_CONFIGSECTION32_PROPERTY" After="CA_SET_MODULE32"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_CONFIGSECTION32" After="CA_ADD_CONFIGSECTION32_PROPERTY"><![CDATA[(NOT REMOVE)]]></Custom> + <Custom Action="CA_ADD_CONFIGSECTION32_PROPERTY_TMP" After="CA_ADD_CONFIGSECTION32"><![CDATA[(NOT REMOVE)]]></Custom> + <Custom Action="CA_ADD_CONFIGSECTION32_TMP" After="CA_ADD_CONFIGSECTION32_PROPERTY_TMP"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION32_PROPERTY" After="CA_ADD_CONFIGSECTION32"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION32" After="CA_ADD_TRACE_PROVIDER_DEFINITION32_PROPERTY"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION_TMP32_PROPERTY" After="CA_ADD_TRACE_PROVIDER_DEFINITION32"><![CDATA[(NOT REMOVE)]]></Custom> @@ -631,6 +555,8 @@ <Custom Action="CA_REMOVE_MODULE32" After="CA_REMOVE_MODULE32_PROPERTY"><![CDATA[(REMOVE~="ALL" AND IISEXPRESS_INSTALL_PATH32 AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_CONFIGSECTION32_PROPERTY" Before="CA_REMOVE_CONFIGSECTION32"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_CONFIGSECTION32" Before="RemoveFiles"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> + <Custom Action="CA_REMOVE_CONFIGSECTION32_PROPERTY_TMP" Before="CA_REMOVE_CONFIGSECTION32_TMP"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> + <Custom Action="CA_REMOVE_CONFIGSECTION32_TMP" Before="RemoveFiles"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_TRACE_PROVIDER_DEFINITION32_PROPERTY" Before="CA_REMOVE_TRACE_PROVIDER_DEFINITION32"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_TRACE_PROVIDER_DEFINITION32" Before="RemoveFiles"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_TRACE_PROVIDER_DEFINITION_TMP32_PROPERTY" Before="CA_REMOVE_TRACE_PROVIDER_DEFINITION_TMP32"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> diff --git a/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV2/ancm_iis_expressv2.wxs b/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV2/ancm_iis_expressv2.wxs index 12a2c887b817794459baf520cb9830f026d6f008..5980137c835e2c379ef2a81cf59ab20f78854c42 100644 --- a/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV2/ancm_iis_expressv2.wxs +++ b/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV2/ancm_iis_expressv2.wxs @@ -377,66 +377,25 @@ Value=""[IISEXPRESS_INSTALL_PATH]appcmd.exe" set config -section:system.webServer/httpCompression /+"dynamicTypes.[\[]mimeType='text/event-stream',enabled='FALSE'[\]]" /apphostconfig:"[IISEXPRESS_APPHOST_CONFIG_TMP]""/> <CustomAction Id="CA_UPDATE_DYNAMIC_COMPRESSION_TMP" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/> - <!-- CA to add config section to applicationhost.config --> <CustomAction Id="CA_ADD_CONFIGSECTION_PROPERTY" Property="CA_ADD_CONFIGSECTION" - Value="[IISEXPRESS_APPHOST_CONFIG];[IISEXPRESS_APPHOST_CONFIG_TMP]"/> - <CustomAction Id="CA_ADD_CONFIGSECTION" Script="jscript" Execute="deferred" Return="check" Impersonate="no"> - <![CDATA[ - var caData = Session.Property("CustomActionData"); - configfiles = caData.split(';'); - for (var i = 0; i < configfiles.length; i++) { - var configfile = configfiles[i]; - var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); - xmlDoc.async = false; - xmlDoc.preserveWhiteSpace = true; - xmlDoc.load(configfile ); - if (xmlDoc.parseError.errorCode == 0) { - xmlDoc.setProperty("SelectionLanguage", "XPath"); - var websvrNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]"); - if (websvrNode != null) { - var ancmNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]/section[@name=\"$(var.AspNetCoreSectionName)\"]"); - if (ancmNode == null) { - ancmNode = xmlDoc.createElement("section"); - ancmNode.setAttribute("name", "$(var.AspNetCoreSectionName)"); - ancmNode.setAttribute("overrideModeDefault", "Allow"); - websvrNode.appendChild(ancmNode); - xmlDoc.save(configfile ); - } - } - } - } - ]]> - </CustomAction> - - <!-- CA to remove config section to applicationhost.config --> + Value="[IISEXPRESS_APPHOST_CONFIG]"/> + <CustomAction BinaryKey="IISCustomActionDll" Id="CA_ADD_CONFIGSECTION" DllEntry="AddConfigSection" Execute="deferred" Return="check" Impersonate="no"/> + + <CustomAction Id="CA_ADD_CONFIGSECTION_PROPERTY_TMP" + Property="CA_ADD_CONFIGSECTION_TMP" + Value="[IISEXPRESS_APPHOST_CONFIG_TMP]"/> + <CustomAction BinaryKey="IISCustomActionDll" Id="CA_ADD_CONFIGSECTION_TMP" DllEntry="AddConfigSection" Execute="deferred" Return="check" Impersonate="no"/> + <CustomAction Id="CA_REMOVE_CONFIGSECTION_PROPERTY" - Property="CA_REMOVE_CONFIGSECTION" - Value="[IISEXPRESS_APPHOST_CONFIG];[IISEXPRESS_APPHOST_CONFIG_TMP]"/> - <CustomAction Id="CA_REMOVE_CONFIGSECTION" Script="jscript" Execute="deferred" Return="check" Impersonate="no"> - <![CDATA[ - var caData = Session.Property("CustomActionData"); - configfiles = caData.split(';'); - for (var i = 0; i < configfiles.length; i++) { - var configfile = configfiles[i]; - var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); - xmlDoc.async = false; - xmlDoc.preserveWhiteSpace = true; - xmlDoc.load(configfile ); - if (xmlDoc.parseError.errorCode == 0) { - xmlDoc.setProperty("SelectionLanguage", "XPath"); - var websvrNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]"); - if (websvrNode != null) { - var ancmNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]/section[@name=\"$(var.AspNetCoreSectionName)\"]"); - if (ancmNode != null) { - websvrNode.removeChild(ancmNode); - xmlDoc.save(configfile ); - } - } - } - } - ]]> - </CustomAction> + Property="CA_REMOVE_CONFIGSECTION" + Value="[IISEXPRESS_APPHOST_CONFIG]"/> + <CustomAction Id="CA_REMOVE_CONFIGSECTION" BinaryKey="IISCustomActionDll" DllEntry="RemoveConfigSection" Execute="deferred" Return="check" Impersonate="no" /> + + <CustomAction Id="CA_REMOVE_CONFIGSECTION_PROPERTY_TMP" + Property="CA_REMOVE_CONFIGSECTION_TMP" + Value="[IISEXPRESS_APPHOST_CONFIG_TMP]"/> + <CustomAction Id="CA_REMOVE_CONFIGSECTION_TMP" BinaryKey="IISCustomActionDll" DllEntry="RemoveConfigSection" Execute="deferred" Return="check" Impersonate="no" /> <?if $(var.Platform) = "x64" ?> <CustomAction Id="CA_UNLOCK_HANDLER32_PROPERTY" @@ -531,68 +490,25 @@ Value=""[IISEXPRESS_INSTALL_PATH32]appcmd.exe" set config -section:system.webServer/httpCompression /+"dynamicTypes.[\[]mimeType='text/event-stream',enabled='FALSE'[\]]" /apphostconfig:"[IISEXPRESS_APPHOST_CONFIG32]""/> <CustomAction Id="CA_UPDATE_DYNAMIC_COMPRESSION_TMP32" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/> - - <!-- CA to add config section to applicationhost.config --> <CustomAction Id="CA_ADD_CONFIGSECTION32_PROPERTY" - Property="CA_ADD_CONFIGSECTION32" - Value="[IISEXPRESS_APPHOST_CONFIG32];[IISEXPRESS_APPHOST_CONFIG_TMP32]"/> - <CustomAction Id="CA_ADD_CONFIGSECTION32" Script="jscript" Execute="deferred" Return="check" Impersonate="no"> - <!-- Warning LGHT1076: ICE03: String overflow. Orca.exe inspection shows the custom action value is populated correctly --> - <![CDATA[ - var caData = Session.Property("CustomActionData"); - configfiles = caData.split(';'); - for (var i = 0; i < configfiles.length; i++) { - var configfile = configfiles[i]; - var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); - xmlDoc.async = false; - xmlDoc.preserveWhiteSpace = true; - xmlDoc.load(configfile); - if (xmlDoc.parseError.errorCode == 0) { - xmlDoc.setProperty("SelectionLanguage", "XPath"); - var websvrNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]"); - if (websvrNode != null) { - var ancmNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]/section[@name=\"$(var.AspNetCoreSectionName)\"]"); - if (ancmNode == null) { - ancmNode = xmlDoc.createElement("section"); - ancmNode.setAttribute("name", "$(var.AspNetCoreSectionName)"); - ancmNode.setAttribute("overrideModeDefault", "Allow"); - websvrNode.appendChild(ancmNode); - xmlDoc.save(configfile); - } - } - } - } - ]]> - </CustomAction> - - <!-- CA to remove config section to applicationhost.config --> + Property="CA_ADD_CONFIGSECTION32" + Value="[IISEXPRESS_APPHOST_CONFIG32]"/> + <CustomAction BinaryKey="IISCustomActionDll" Id="CA_ADD_CONFIGSECTION32" DllEntry="AddConfigSection" Execute="deferred" Return="check" Impersonate="no"/> + + <CustomAction Id="CA_ADD_CONFIGSECTION32_PROPERTY_TMP" + Property="CA_ADD_CONFIGSECTION32_TMP" + Value="[IISEXPRESS_APPHOST_CONFIG_TMP32]"/> + <CustomAction BinaryKey="IISCustomActionDll" Id="CA_ADD_CONFIGSECTION32_TMP" DllEntry="AddConfigSection" Execute="deferred" Return="check" Impersonate="no"/> + <CustomAction Id="CA_REMOVE_CONFIGSECTION32_PROPERTY" Property="CA_REMOVE_CONFIGSECTION32" - Value="[IISEXPRESS_APPHOST_CONFIG32];[IISEXPRESS_APPHOST_CONFIG_TMP32]"/> - <CustomAction Id="CA_REMOVE_CONFIGSECTION32" Script="jscript" Execute="deferred" Return="check" Impersonate="no"> - <![CDATA[ - var caData = Session.Property("CustomActionData"); - configfiles = caData.split(';'); - for (var i = 0; i < configfiles.length; i++) { - var configfile = configfiles[i]; - var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); - xmlDoc.async = false; - xmlDoc.preserveWhiteSpace = true; - xmlDoc.load(configfile); - if (xmlDoc.parseError.errorCode == 0) { - xmlDoc.setProperty("SelectionLanguage", "XPath"); - var websvrNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]"); - if (websvrNode != null) { - var ancmNode = xmlDoc.selectSingleNode("//configuration/configSections/sectionGroup[@name=\"system.webServer\"]/section[@name=\"$(var.AspNetCoreSectionName)\"]"); - if (ancmNode != null) { - websvrNode.removeChild(ancmNode); - xmlDoc.save(configfile); - } - } - } - } - ]]> - </CustomAction> + Value="[IISEXPRESS_APPHOST_CONFIG32]"/> + <CustomAction Id="CA_REMOVE_CONFIGSECTION32" BinaryKey="IISCustomActionDll" DllEntry="RemoveConfigSection" Execute="deferred" Return="check" Impersonate="no" /> + + <CustomAction Id="CA_REMOVE_CONFIGSECTION32_PROPERTY_TMP" + Property="CA_REMOVE_CONFIGSECTION32_TMP" + Value="[IISEXPRESS_APPHOST_CONFIG_TMP32]"/> + <CustomAction Id="CA_REMOVE_CONFIGSECTION32_TMP" BinaryKey="IISCustomActionDll" DllEntry="RemoveConfigSection" Execute="deferred" Return="check" Impersonate="no" /> <?endif?> <InstallExecuteSequence> @@ -611,7 +527,9 @@ <Custom Action="CA_SET_MODULE" After="CA_SET_MODULE_PROPERTY"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_CONFIGSECTION_PROPERTY" After="CA_SET_MODULE"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_CONFIGSECTION" After="CA_ADD_CONFIGSECTION_PROPERTY"><![CDATA[(NOT REMOVE)]]></Custom> - <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION_PROPERTY" After="CA_ADD_CONFIGSECTION"><![CDATA[(NOT REMOVE)]]></Custom> + <Custom Action="CA_ADD_CONFIGSECTION_PROPERTY_TMP" After="CA_ADD_CONFIGSECTION"><![CDATA[(NOT REMOVE)]]></Custom> + <Custom Action="CA_ADD_CONFIGSECTION_TMP" After="CA_ADD_CONFIGSECTION_PROPERTY_TMP"><![CDATA[(NOT REMOVE)]]></Custom> + <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION_PROPERTY" After="CA_ADD_CONFIGSECTION_TMP"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION" After="CA_ADD_TRACE_PROVIDER_DEFINITION_PROPERTY"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION_TMP_PROPERTY" After="CA_ADD_TRACE_PROVIDER_DEFINITION"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION_TMP" After="CA_ADD_TRACE_PROVIDER_DEFINITION_TMP_PROPERTY"><![CDATA[(NOT REMOVE)]]></Custom> @@ -621,6 +539,8 @@ <Custom Action="CA_REMOVE_MODULE" Before="RemoveFiles"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_CONFIGSECTION_PROPERTY" Before="CA_REMOVE_CONFIGSECTION"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_CONFIGSECTION" Before="RemoveFiles"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> + <Custom Action="CA_REMOVE_CONFIGSECTION_PROPERTY_TMP" Before="CA_REMOVE_CONFIGSECTION_TMP"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> + <Custom Action="CA_REMOVE_CONFIGSECTION_TMP" Before="RemoveFiles"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_TRACE_PROVIDER_DEFINITION_PROPERTY" Before="CA_REMOVE_TRACE_PROVIDER_DEFINITION"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_TRACE_PROVIDER_DEFINITION" Before="RemoveFiles"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_TRACE_PROVIDER_DEFINITION_TMP_PROPERTY" Before="CA_REMOVE_TRACE_PROVIDER_DEFINITION_TMP"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> @@ -651,7 +571,9 @@ <Custom Action="CA_SET_MODULE32" After="CA_ADD_MODULE32_PROPERTY"><![CDATA[(NOT REMOVE AND IISEXPRESS_INSTALL_PATH32)]]></Custom> <Custom Action="CA_ADD_CONFIGSECTION32_PROPERTY" After="CA_SET_MODULE32"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_CONFIGSECTION32" After="CA_ADD_CONFIGSECTION32_PROPERTY"><![CDATA[(NOT REMOVE)]]></Custom> - <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION32_PROPERTY" After="CA_ADD_CONFIGSECTION32"><![CDATA[(NOT REMOVE)]]></Custom> + <Custom Action="CA_ADD_CONFIGSECTION32_PROPERTY_TMP" After="CA_ADD_CONFIGSECTION32"><![CDATA[(NOT REMOVE)]]></Custom> + <Custom Action="CA_ADD_CONFIGSECTION32_TMP" After="CA_ADD_CONFIGSECTION32_PROPERTY_TMP"><![CDATA[(NOT REMOVE)]]></Custom> + <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION32_PROPERTY" After="CA_ADD_CONFIGSECTION32_TMP"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION32" After="CA_ADD_TRACE_PROVIDER_DEFINITION32_PROPERTY"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION_TMP32_PROPERTY" After="CA_ADD_TRACE_PROVIDER_DEFINITION32"><![CDATA[(NOT REMOVE)]]></Custom> <Custom Action="CA_ADD_TRACE_PROVIDER_DEFINITION_TMP32" After="CA_ADD_TRACE_PROVIDER_DEFINITION_TMP32_PROPERTY"><![CDATA[(NOT REMOVE)]]></Custom> @@ -661,6 +583,8 @@ <Custom Action="CA_REMOVE_MODULE32" After="CA_REMOVE_MODULE32_PROPERTY"><![CDATA[(REMOVE~="ALL" AND IISEXPRESS_INSTALL_PATH32 AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_CONFIGSECTION32_PROPERTY" Before="CA_REMOVE_CONFIGSECTION32"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_CONFIGSECTION32" Before="RemoveFiles"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> + <Custom Action="CA_REMOVE_CONFIGSECTION32_PROPERTY_TMP" Before="CA_REMOVE_CONFIGSECTION32_TMP"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> + <Custom Action="CA_REMOVE_CONFIGSECTION32_TMP" Before="RemoveFiles"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_TRACE_PROVIDER_DEFINITION32_PROPERTY" Before="CA_REMOVE_TRACE_PROVIDER_DEFINITION32"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_TRACE_PROVIDER_DEFINITION32" Before="RemoveFiles"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> <Custom Action="CA_REMOVE_TRACE_PROVIDER_DEFINITION_TMP32_PROPERTY" Before="CA_REMOVE_TRACE_PROVIDER_DEFINITION_TMP32"><![CDATA[(REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE)]]></Custom> diff --git a/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.cpp b/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.cpp index 48d826f720240b15fbffb36c2ed4c32b5d2dba8f..7b43840c52a432966a83c567e664f5248d48a68c 100644 --- a/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.cpp +++ b/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.cpp @@ -2,6 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. #include <precomp.h> +#include <MsiQuery.h> +#include <msxml6.h> DECLARE_DEBUG_PRINT_OBJECT( "proxyCA.dll" ); @@ -40,6 +42,137 @@ struct COMPRESSION_MIME_TYPE COMPRESSION_MIME_TYPE gMimeTypes[] = { { L"text/event-stream", FALSE} }; +#define _HR_RET(hr) __pragma(warning(push)) \ + __pragma(warning(disable:26498)) /*disable constexpr warning */ \ + const HRESULT __hrRet = hr; \ + __pragma(warning(pop)) + +#define _GOTO_FINISHED() __pragma(warning(push)) \ + __pragma(warning(disable:26438)) /*disable avoid goto warning*/ \ + goto Finished \ + __pragma(warning(pop)) + +#define RETURN_IF_FAILED(hrr) do { _HR_RET(hrr); if (FAILED(__hrRet)) { hr = __hrRet; IISLogWrite(SETUP_LOG_SEVERITY_INFORMATION, L"Exiting hr=0x%x", hr); return hr; }} while (0, 0) + +// Modifies the configSections to include the aspNetCore section +UINT +WINAPI +AddConfigSection( + IN MSIHANDLE handle +) +{ + HRESULT hr; + CComPtr<IXMLDOMDocument2> pXMLDoc; + VARIANT_BOOL variantResult; + IXMLDOMNode* webServerNode; + IXMLDOMNode* aspNetCoreNode; + IXMLDOMNode* tempNode; + IXMLDOMElement* element; + STRU customActionData; + + CComBSTR selectLanguage = SysAllocString(L"SelectionLanguage"); + CComBSTR xPath = SysAllocString(L"XPath"); + CComBSTR webServerPath = SysAllocString(L"//configuration/configSections/sectionGroup[@name=\"system.webServer\"]"); + CComBSTR aspNetCorePath = SysAllocString(L"//configuration/configSections/sectionGroup[@name=\"system.webServer\"]/section[@name=\"aspNetCore\"]"); + CComBSTR section = SysAllocString(L"section"); + CComBSTR name = SysAllocString(L"name"); + CComBSTR aspNetCore = SysAllocString(L"aspNetCore"); + CComBSTR overrideMode = SysAllocString(L"overrideModeDefault"); + CComBSTR allow = SysAllocString(L"Allow"); + + RETURN_IF_FAILED(CoInitialize(NULL)); + + hr = MsiUtilGetProperty(handle, TEXT("CustomActionData"), &customActionData); + + RETURN_IF_FAILED(hr = pXMLDoc.CoCreateInstance(__uuidof(DOMDocument60))); + + RETURN_IF_FAILED(hr = pXMLDoc->put_async(false)); + + RETURN_IF_FAILED(hr = pXMLDoc->load(CComVariant(customActionData.QueryStr()), &variantResult)); + + if (variantResult == VARIANT_FALSE) + { + return ERROR_SUCCESS; + } + + RETURN_IF_FAILED(hr = pXMLDoc->setProperty(selectLanguage, CComVariant(xPath))); + + RETURN_IF_FAILED(hr = pXMLDoc->selectSingleNode(webServerPath, &webServerNode)); + + RETURN_IF_FAILED(hr = pXMLDoc->selectSingleNode(aspNetCorePath, &aspNetCoreNode)); + + if (aspNetCoreNode == NULL) + { + RETURN_IF_FAILED(hr = pXMLDoc->createElement(section, &element)); + + RETURN_IF_FAILED(hr = element->setAttribute(name, CComVariant(aspNetCore))); + + RETURN_IF_FAILED(hr = element->setAttribute(overrideMode, CComVariant(allow))); + + RETURN_IF_FAILED(hr = webServerNode->appendChild(element, &tempNode)); + + RETURN_IF_FAILED(hr = pXMLDoc->save(CComVariant(customActionData.QueryStr()))); + } + + return ERROR_SUCCESS; +} + +// Modifies the configSections to remove the aspNetCore section +UINT +WINAPI +RemoveConfigSection( + IN MSIHANDLE handle +) +{ + HRESULT hr; + CComPtr<IXMLDOMDocument2> pXMLDoc; + VARIANT_BOOL variantResult; + IXMLDOMNode* webServerNode; + IXMLDOMNode* aspNetCoreNode; + IXMLDOMNode* tempNode; + STRU customActionData; + + CComBSTR selectLanguage = SysAllocString(L"SelectionLanguage"); + CComBSTR xPath = SysAllocString(L"XPath"); + CComBSTR webServerPath = SysAllocString(L"//configuration/configSections/sectionGroup[@name=\"system.webServer\"]"); + CComBSTR aspNetCorePath = SysAllocString(L"//configuration/configSections/sectionGroup[@name=\"system.webServer\"]/section[@name=\"aspNetCore\"]"); + CComBSTR section = SysAllocString(L"section"); + CComBSTR name = SysAllocString(L"name"); + CComBSTR aspNetCore = SysAllocString(L"aspNetCore"); + CComBSTR overrideMode = SysAllocString(L"overrideModeDefault"); + CComBSTR allow = SysAllocString(L"Allow"); + + RETURN_IF_FAILED(CoInitialize(NULL)); + + hr = MsiUtilGetProperty(handle, TEXT("CustomActionData"), &customActionData); + + RETURN_IF_FAILED(hr = pXMLDoc.CoCreateInstance(__uuidof(DOMDocument60))); + + RETURN_IF_FAILED(hr = pXMLDoc->put_async(false)); + + RETURN_IF_FAILED(hr = pXMLDoc->load(CComVariant(customActionData.QueryStr()), &variantResult)); + + if (variantResult == VARIANT_FALSE) + { + return ERROR_SUCCESS; + } + + RETURN_IF_FAILED(hr = pXMLDoc->setProperty(selectLanguage, CComVariant(xPath))); + + RETURN_IF_FAILED(hr = pXMLDoc->selectSingleNode(webServerPath, &webServerNode)); + + RETURN_IF_FAILED(hr = pXMLDoc->selectSingleNode(aspNetCorePath, &aspNetCoreNode)); + + if (aspNetCoreNode != NULL) + { + RETURN_IF_FAILED(webServerNode->removeChild(aspNetCoreNode, &tempNode)); + + RETURN_IF_FAILED(hr = pXMLDoc->save(CComVariant(customActionData.QueryStr()))); + } + + return ERROR_SUCCESS; +} + UINT WINAPI RegisterANCMCompressionCA( diff --git a/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.def b/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.def index 3518cde35f8d590410d61db5803da96282e0ddb9..ed516a4392b22de68ec34e10e1c9c28cbd438c1e 100644 --- a/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.def +++ b/src/Installers/Windows/AspNetCoreModule-Setup/CustomAction/aspnetcoreCA.def @@ -18,6 +18,8 @@ EXPORTS ExecuteCleanUpWindowsHotfixCA ScheduleRebootIfRequiredCA + AddConfigSection + RemoveConfigSection RegisterANCMCompressionCA CheckForServicesRunningCA diff --git a/src/Installers/Windows/UpgradeLog.htm b/src/Installers/Windows/UpgradeLog.htm new file mode 100644 index 0000000000000000000000000000000000000000..f327ebd6ec8c9266607c164392462b8d434be9e7 Binary files /dev/null and b/src/Installers/Windows/UpgradeLog.htm differ