I have this component in my .wxs file:
<Component Id="Component.IisConfiguration" Guid="[COMPONENT_GUID_IISSITE]">
<iis:WebAppPool Id="IIS.AppPool" Name="[WEB_APP_POOL_NAME]" Identity="networkService" ManagedRuntimeVersion="v4.0" />
<iis:WebSite Id="IIS.WebSite" Description="[WEB_APP_NAME]" SiteId="[WEB_APP_SITEID]" Directory="TARGETDIR" >
<iis:WebApplication Id="IIS.WebSite.Application" Name="[WEB_APP_POOL_NAME]" WebAppPool="IIS.AppPool" />
<iis:WebAddress Id="IIS.WebSite.WebAddress.Port" Port="[WEB_APP_ADDRESS_PORT]" />
<iis:WebDirProperties Id="IIS.WebSite.Authentication" WindowsAuthentication="yes" />
</iis:WebSite>
</Component>
Is it possible to set "ASP.NET Impersonation" anywhere ?
It seems there's no out-of-the-box switch for this. You can have a custom action which calls:
appcmd set config /commit:WEBROOT/section:identity /impersonate:true
See this article for more information.
On the other hand, you can always set this setting on the application level, and use the standard XmlConfig element to modify the web.config file for this.
Related
I am working on a web application. the Web.config file is set to NeverOverwrite (=yes) in its initial installation. Now i need to add DBproviderfactories like below. Can i add this entire block using XmlFile in a patch.msp? I do not want to write a custom action. All I need is to add this block in the web.config. Any suggestion here is appreciated.
<system.data>
<DbProviderFactories>
<!-- Remove in case this is already defined in machine.config -->
<remove invariant="Oracle.ManagedDataAccess.Client" />
<add name="Oracle Data Provider for .NET" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
Sample: Maybe try this:
https://github.com/glytzhkof/WiXUpdateXmlFile
Below is the gist of it - please use the sample above for testing. The markup below is just for illustration.
Set the XML file both permanent and never overwrite.
See inline instructions in the sample above for testing.
Check what happens on uninstall - this markup will remove the entries it added.
<!-- Set app.config permanent and never overwrite to yes -->
<Component Feature="ProductFeature" NeverOverwrite="yes" Permanent="yes">
<File Source="app.config" />
</Component>
<!-- The XML update -->
<!-- Use a NEW GUID here, do not go live with this one -->
<Component Id="XmlFileUpdate" Guid="{00000000-0000-0000-0000-7405EED51B57}" Feature='ProductFeature'>
<!--Create New Element-->
<util:XmlFile Id='XmlSettings1' File='[INSTALLFOLDER]app.config' Action='createElement' Name='MyConfig' ElementPath='//configuration' Sequence='1' />
<!--Set New Value-->
<util:XmlFile Id='XmlSettings2' File='[INSTALLFOLDER]app.config' Action='setValue' Name='newVersion' Value='6.6.8' ElementPath='//configuration/MyConfig' Sequence='2' />
<!--Set New Value-->
<util:XmlFile Id='XmlSettings3' File='[INSTALLFOLDER]app.config' Action='setValue' Name='Server' Value='Pusevov' ElementPath='//configuration/MyConfig' Sequence='3' />
<!--Update Existing Value, Existing Element-->
<util:XmlFile Id='XmlSettings4' File='[INSTALLFOLDER]app.config'
Action='setValue' Name='newVersion' Value='7.7.7' ElementPath='//configuration/ExistingConfig/bindingRedirect' Sequence='4' />
<CreateFolder />
</Component>
</Directory>
</Directory>
Link:
Added new application setting to app.config but MSI won't install it (doesn't overwrite)
We are using WIX 3.10 to create web applications under default website, this implementation works fine but the issue is with uninstall of the product that it does not remove the web application under the default website.
The Website port and name are entered by user as part of custom dialog which are stored in respective properties.further during uninstall these properties are restored using wix toolset remember property http://robmensching.com/blog/posts/2010/5/2/the-wix-toolsets-remember-property-pattern/ which sets the web application property during uninstall, but still the application is not removed on uninstall.
Uninstall log that sets the website properties after Appsearch:
Action start 15:17:04: AppSearch.
MSI (s) (24:64) [15:17:04:657]: Note: 1: 2262 2: Signature 3: -2147287038
MSI (s) (24:64) [15:17:04:657]: PROPERTY CHANGE: Modifying WEBSITEPORTPROPERTY property. Its current value is 'WEBSITEPORT'. Its new value: '80'.
MSI (s) (24:64) [15:17:04:657]: Note: 1: 2262 2: Signature 3: -2147287038
MSI (s) (24:64) [15:17:04:657]: PROPERTY CHANGE: Modifying WEBSITEPROPERTY property. Its current value is 'WEBSITE'. Its new value: 'Default Web Site'.
<Fragment>
<iis:WebSite Id="SITE" Description="[WEBSITE]">
<iis:WebAddress Id="AllUnassigned" Port="[WEBSITEPORT]"/>
</iis:WebSite>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="TestAppPool" Guid="GUID" KeyPath="yes" Permanent="yes">
<iis:WebAppPool Id="TestAppPool"
Name="Test Net 4.0"
Identity="applicationPoolIdentity"
ManagedPipelineMode="Integrated"
ManagedRuntimeVersion="v4.0" />
</Component>
<Component Id="IIS.Component" Guid="GUID" KeyPath="yes" Permanent="no" Win64="yes">
<iis:WebVirtualDir Id="VirtualDir" Alias="[APPLICATION_NAME]" Directory="Dir" WebSite="SITE" >
<iis:WebApplication Id="Application" Name="[APPLICATION_NAME]" WebAppPool="TestAppPool"/>
</iis:WebVirtualDir>
<RegistryValue Root='HKLM' Key='SOFTWARE\Test\Prod' Name='Website' Value='[WEBSITE]' Type='string' Action='write' />
<RegistryValue Root='HKLM' Key='SOFTWARE\Test\Prod' Name='WebsitePort' Value='[WEBSITEPORT]' Type='string' Action='write' />
<RegistryValue Root='HKLM' Key='SOFTWARE\Test\Prod' Name='Application' Value='[APPLICATION_NAME]' Type='string' Action='write' />
</Component>
</DirectoryRef>
</Fragment>
There is another issue related, repair operation through Add Remove Programs throws a Fatal error with the following error:
WriteIIS7ConfigChanges: Entering WriteIIS7ConfigChanges in C:\Windows\Installer\MSICDDF.tmp, version 3.10.3007.0
WriteIIS7ConfigChanges: Custom action data hash: 41034C345A4E6B9B4DDB8490C1BC5266637BC0E8
WriteIIS7ConfigChanges: CustomActionData WriteIIS7ConfigChanges length: 225
WriteIIS7ConfigChanges: Error 0x80070002: Site not found for create application
WriteIIS7ConfigChanges: Error 0x80070002: Failed to configure IIS application.
WriteIIS7ConfigChanges: Error 0x80070002: WriteIIS7ConfigChanges Failed.
Any other alternative solution that would solve the issue?
I need to install one set of files based on OS version and another set if some other OS is there,I have written a condition also but that condition doesn't work properly .
<Component Id="actionBin_Win7" Guid="6b73cbe1-4017-48d7-9cdc-784517b2d7a9" DiskId="1">
<Condition><![CDATA[(VersionNT >= 600)]]></Condition>
<File Id="file30" Name="AXINTE_2.DLL" LongName="AxInterop.MSTSCLib.dll" src="$(var.agentroot)\bin\AxInterop.MSTSCLib_Win7.dll" />
<File Id="file31" Name="ZENRDP_2.EXE" LongName="ZENRdpClient.exe" src="$(var.agentroot)\bin\ZENRdpClient_Win7.exe" />
<File Id="file32" Name="INTERO_2.DLL" LongName="Interop.MSTSCLib.dll" src="$(var.agentroot)\bin\Interop.MSTSCLib_Win7.dll" />
</Component>
<Component Id="actionBin" Guid="7388F2C9-5CDD-49a8-80F7-7DF5829AE87E" DiskId="1">
<Condition><![CDATA[(VersionNT < 600)]]></Condition>
<File Id="file10" Name="AXINTE_1.DLL" LongName="AxInterop.MSTSCLib.dll" src="$(var.agentroot)\bin\AxInterop.MSTSCLib.dll" />
<File Id="file11" Name="msrdp.ocx" LongName="msrdp.ocx" SelfRegCost="1" src="$(var.agentroot)\bin\msrdp.ocx" />
<File Id="file12" Name="ZENRDP_1.EXE" LongName="ZENRdpClient.exe" src="$(var.agentroot)\bin\ZENRdpClient.exe" />
<File Id="file13" Name="INTERO_1.DLL" LongName="Interop.MSTSCLib.dll" src="$(var.agentroot)\bin\Interop.MSTSCLib.dll" />
<File Id="file14" Name="shortcut.vbs" LongName="shortcut.vbs" src="$(var.agentroot)\bin\shortcut.vbs" />
</Component>
Feature :
<Feature Id="AllComponents" Title="AllComponents" Level="1">
<ComponentRef Id="actionBin" />
<ComponentRef Id="actionBin_Win7" />
</Feature>
Any idea what is going wrong here? Even when OS is windows 7, MSI takes files which I intend for WinXP...
Thanks in advance.
As far as i know about WIX, CDATA is used of ASCII comparison and not for integer comparison.
You can use custom action to compare OS version and then assign true or false value to some session variable and then you can use that session variable in wxs file.
I have a website that I am installing for one of our internal products, and would like to know if there is a way to set up multiple <WebAddress/> blocks to be conditionally installed along with this one website?
Consider my basic website authoring below:
<Component
Id="WebsiteComp"
Directory="INSTALLDIR"
Guid="{702AF20D-F9F3-45A1-B966-890855904591}"
KeyPath="yes">
<iis:WebAppPool
Id="AppPool"
Name="OurSite"
ManagedPipelineMode="Integrated"
ManagedRuntimeVersion="v4.0"/>
<iis:WebSite
Id="Website"
Description="[WEBSITENAME]"
Directory="INSTALLDIR">
<iis:WebApplication
Id="WebApp"
Name="[WEBSITENAME]"
WebAppPool="AppPool"/>
<!-- if ENV = "DEV" -->
<iis:WebAddress
Id="DevHostHeader"
Header="dev.product.company.com"
Port="80"/>
<!-- if ENV = "QA" -->
<iis:WebAddress
Id="QaHostHeader"
Header="qa.product.company.com"
Port="80"/>
<iis:WebAddress
Id="QaHostHeader"
Header="product.qa1.company.com"
Port="80"/>
<!-- if ENV = "PROD" -->
<iis:WebAddress
Id="ProdHostHeader"
Header="prod.product.com"
Port="80"/>
</iis:WebSite>
</Component>
<Component/> is the most specific element that a condition can applied to. But in order to specify the condition there I have to duplicate all my web site auhtoring for each environment, correct?
Is there a way to author one version of the <WebAppPool/>, <WebSite/>, and <WebApplication/> and then have different versions and quantities (like QA in the above example) of <WebAddress/> inserted/chosen based on the condition of a propertie's value?
I really don't want to get into making multiple versions of the installer for a specific environment.
Thank you,
Zachary
You can approach the problem in a different way.
You can have a single WebAddress element, and the Header attribute will take the value of the property. Like this:
<iis:WebAddress Id="HostHeader" Header="[HOSTHEADER]" Port="80"/>
Now, based on the condition (production, DEV, QA) you set the property to the required value, for instance, qa.product.company.com for QA. Thus, you'll conditionally install the host header you need, and will keep a single WebAddress entry in the sources. Note, that Port attribute can accept the property values as well.
Well, I figured out how to do it without code duplication... pre-processor to the rescue!
Here's a simplified look at my "web services" directory:
ProductName.WebService.wxs
ProductName.DEV.WebAddress.wxi
ProductName.PROD.WebAddress.wx
ProductName.QA1.WebAddress.wxi
ProductName.WebService.wxs is as follows:
<Wix
xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension">
<Fragment>
<iis:WebDirProperties .../>
<?foreach EnvID in DEV;PROD;QA1 ?>
<?define FullEnvID = "ProductName.$(var.EnvID)" ?>
<?if $(var.EnvID) = "DEV" ?>
<?define CompGUID = "{DFEAC94A-590E-4E92-9206-E574ABDDBB29}" ?>
<?elseif $(var.EnvID) = "PROD" ?>
<?define CompGUID = "{FEE4FBB1-9894-48F4-8DDC-9FC83F8AD778}" ?>
<?elseif $(var.EnvID) = "QA1" ?>
<?define CompGUID = "{EED17AF6-BF99-4B34-821D-6A8487292111}" ?>
<?endif ?>
<Component
Id="$(var.FullEnvID).WebSvc"
Directory="INSTALLDIR"
Guid="$(var.CompGUID)"
KeyPath="yes">
<Condition><![CDATA[ENV="$(var.EnvID)"]]></Condition>
<iis:WebAppPool
Id="$(var.FullEnvID).WebAppPool"
Name="[WEBSITENAME]"
ManagedPipelineMode="Integrated"
ManagedRuntimeVersion="v4.0"/>
<iis:WebSite
Id="$(var.FullEnvID).Website"
Description="[WEBSITENAME]"
Directory="INSTALLDIR">
<iis:WebApplication
Id="$(var.FullEnvID).WebApplication"
Name="[WEBSITENAME]"
WebAppPool="$(var.FullEnvID).WebAppPool"/>
<?include $(var.FullEnvID).WebAddress.wxi ?>
</iis:WebSite>
</Component>
<?undef CompGUID ?>
<?undef FullEnvID ?>
<?endforeach ?>
</Fragment>
</Wix>
<Condition><![CDATA[ENV="$(var.EnvID)"]]></Condition> determines which web site component is installed
<?include $(var.FullEnvID).WebAddress.wxi ?> slips in just the <iis:WebAddress/> sections as the loop iterates.
Here's what ProductName.DEV.WebAddress.wxi looks like:
<Include
xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension">
<iis:WebAddress
Id="dev.product.company.com"
Header="dev.product.company.com"
Port="80"/>
<iis:WebAddress
Id="product.dev.company.com"
Header="product.dev.company.com"
Port="80"/>
</Include>
This was working in WiX 3.0.
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="inetpubDir" Name="inetpub">
<Directory Id="wwwrootDir" Name="wwwroot">
<Directory Id="INSTALLDIR" Name="DS3000Services" FileSource="\Server\Implementation\DS3000Services\Web">
<Component Id="DS3000ServicesVirtualDir" Guid="{4EFD7047-09F4-42e7-ACB5-A209D26B0338}">
<CreateFolder />
<iis:WebAppPool Id="AppPool" Name="[AppPoolName]" Identity="other" User="PortalUser" IdleTimeout="0" RecycleMinutes="0">
<iis:RecycleTime Value="1:00" />
</iis:WebAppPool>
<iis:WebVirtualDir Id="DS3000ServicesVirtualDir" Alias="[VIRTUALDIR]" Directory="INSTALLDIR" WebSite="DefaultWebSite">
<iis:WebApplication Id="DS3000ServicesApp" Name="DS3000 Services" Isolation="medium" WebAppPool="AppPool" />
</iis:WebVirtualDir>
</Component>
Install Log:
MSI (s) (10:E8) [09:57:58:553]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI14A0.tmp, Entrypoint: WriteIIS7ConfigChanges
WriteIIS7ConfigChanges: Error 0x800700b7: Failed to add appPool element
WriteIIS7ConfigChanges: Error 0x800700b7: Failed to configure IIS appPool.
WriteIIS7ConfigChanges: Error 0x800700b7: WriteIIS7ConfigChanges Failed.
CustomAction WriteIIS7ConfigChanges returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (10:4C) [09:57:58:585]: User policy value 'DisableRollback' is 0
MSI (s) (10:4C) [09:57:58:585]: Machine policy value 'DisableRollback' is 0
Action ended 9:57:58: InstallFinalize. Return value 3.
Installing on Win Server 2008 R2. The AppPool already exists. If I remove the AppPool, the installer succeeds. Any thoughts? Thanks...
I would recommend you to create a customAction for creating virtual directory along with Application Pool.
I have used custom action in my project for that purpose. In the custom action you can check whether the application pool with the given name exists or not.
Added inbuilt commands
<Component Id="VDWeb" Guid="493E3487-AA4C-4476-8CC0-4B1C763AF6F7" Permanent="no">
<iis:WebVirtualDir Id="VDir" Alias="[VDNAME]" Directory="dir_Application_0" WebSite="WebSelectedWebSite">
<iis:WebApplication Id="WebApp" Name="[VDNAME]" WebAppPool="ABCAppPool" />
</iis:WebVirtualDir>
<RegistryKey Root="HKLM" Action="createAndRemoveOnUninstall" Key="SOFTWARE\ABC\[ProductCode]\VirtualDirectory">
<RegistryValue Name="VDName" Type="string" Value="[VDNAME]"/>
</RegistryKey>
</Component>
<Component Id="AppPool_1" Guid="414a377f-e044-49d5-b905-66bf3da6489f" Permanent="no">
<util:User Id="PoolAccount" Domain="[DOMAINNAME]" Name="[LogonUser]" Password="[NT_PASSWORD]" CreateUser="no">
<util:GroupRef Id="IISUsersGroup"/>
</util:User>
<iis:WebAppPool Id="ABCAppPool_NT" Name="[APPPOOLNAME_NT]" ManagedRuntimeVersion="v4.0" ManagedPipelineMode="integrated" Identity="other" User="PoolAccount">
<iis:RecycleTime Value="05:00" />
</iis:WebAppPool>
</Component>
<util:Group Id="IISUsersGroup" Name="IIS_IUSRS"/>
<iis:WebSite Id="WebSelectedWebSite" Description="[WEB_WEBSITE_DESCRIPTION]">
<iis:WebAddress Id="AllUnassigned1" Port="[WEB_WEBSITE_PORT]" IP="[WEB_WEBSITE_IP]" Header="[WEB_WEBSITE_HEADER]" />
</iis:WebSite>
Am using this and it works perfectly fine.