I try to learn how to do an installer with WIX on Visual Studio 2012, First I create an HelloWorld Project to test WIX and to do an easy configuration. But I have an error during the building : It says me :
"Failed to open the database. During validation, this most commonly happens when attempting to open a database using an unsupported code page or a file that is not a valid Windows Installer database. Please use a different code page in Module/#Codepage, Package/#SummaryCodepage, Product/#Codepage, or WixLocalization/#Codepage; or make sure you provide the path to a valid Windows Installer database. light.exe 0 1 SetupProject1"
I see several solution like change XML's encoding, switch utf-8 by utf-16. And I also try to delete the encoding statement. But it changes nothing.
Here is my WIX XML :
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="54612752-7163-4B36-8CA6-01615090CD7F" Name="WIXTestSetup" Language="1033" Codepage="1252" Version="1.0.0.0" Manufacturer="MyCompany Ltd."
UpgradeCode="1756bfd5-c713-412a-9524-fb1b72886116">
<Package Id="*" Keywords="Installer" Description="My WIXTest Installer" Languages="1033" SummaryCodepage="1252" InstallerVersion="200"
Compressed="yes" InstallScope="perMachine" Comments="WIXTest Installer is a registered trademark of MyCompany and Co.Ltd" />
<Media Id="1" Cabinet="Sample.cab" EmbedCab="yes" DiskPrompt="CD-ROM #1" />
<Property Id="DiskPrompt" Value="WIXTestSetup Installation [1]"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Feature Id="ProductFeature" Title="WIXTestSetup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="MyCompany" Name = "MyCompany" >
<Directory Id="INSTALLFOLDER" Name="WIXTestSetup" />
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<Component Id="MainExecutable" Guid="4BFF8919-9C07-4BBE-BD1C-46AB49524566">
<!-- TODO: Insert files, registry keys, and other resources here. -->
<File Id="WIxTestExe" Name ="WIXTest.exe" DiskId="1" Source="D:\PROJETS VISUAL STUDIO\Projects\MyFirstWIXProject\MyFirstWIXProject\bin\Debug\MyFirstWIXProject.exe" KeyPath="yes" />
</Component>
<Component Id="ProgramFilesFolder" Guid="53B3FC8A-9D2B-4CDD-BE68-D155435C6163">
<RemoveFolder Id="ProgramFilesFolder" On="uninstall"/>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
I also check "CodePage" and "SummaryCodePage" but I've not resolve the build problem.
I've tried that too : WiX ICE validation errors
Have you some Idea to fix it ?
In the database validation step, light.exe tries to reopen the MSI file for read/write access While anti virus scanning the new msi file that been created.
Try to do the following:
Exclude the temporary directory from the real-time virus scan.
Adding English input language in Windows' regional settings.
Disable the ICE validation. Go to the wix Project Properties, Tool Settings, then checked "Suppress ICE validation".
You can check discussion related to this topic, here:
Error LGHT0301: Failed to open the database
Related
I'm writing a Wix Toolset installer to install an Angular + asp.net core application in IIS on Windows Server 2016. I create a new Website and a new Application Pool. I want to grant full permission to the Application Pool identity on the newly created website folder path.
I followed the step given here : https://www.codeproject.com/Articles/115036/Creating-WIX-Installer-for-ASP-NET-Web-Application? so I have 3 files :
Setup.wxs
IISConfiguration.wxs
WebSiteContent.wxs
I set up the website and permissions in IISConfiguration.wxs.
<DirectoryRef Id="WEBSITE">
<Component Id="WebSiteSiteNameCmp" Guid="{ED376FD7-D4DB-4675-8BF4-1DCC1AF1C66B}" KeyPath="yes" >
<iis:WebSite Id="WebSiteName"
Description='WebSiteName'
Directory="WEBSITE"
AutoStart="no"
ConfigureIfExists="yes"
StartOnInstall="no" >
<iis:WebAddress Id="WebSiteAdressHttps" Port="443" IP="*" Secure="yes"/>
<iis:WebAddress Id="WebSiteAdressHttp" Port="80" IP="*" Secure="no"/>
<iis:WebDirProperties Id="WebSiteProperties" AnonymousAccess="yes"
BasicAuthentication="no" WindowsAuthentication="no" />
<iis:WebApplication Id="WebSiteNameSite" Name="WebSite" WebAppPool="WebSiteAppPool" />
</iis:WebSite>
</Component>
<!-- Configuring app pool -->
<Component Id="WebSiteAppPoolCmp" Guid="{009052A8-19AE-452e-AE34-6DC8E929DA08}"
KeyPath="yes" Permanent="yes" Win64="yes">
<iis:WebAppPool Id="WebSiteAppPool" Name="WebSiteAppPoolName" ManagedPipelineMode="integrated" />
</Component>
<Component Id="WebSitePermissionCmp" Guid="{4425EFB0-A580-44B7-9C04-54EBD2E4ECB1}">
<CreateFolder>
<util:PermissionEx User="IIS AppPool\WebSiteAppPoolName" GenericAll="yes"/>
</CreateFolder>
</Component>
</DirectoryRef>
But then the installer rollsback because the AppPool isn't created yet when trying to set permissions on the folder. I have the following error in my logs :
ExecSecureObjects: Error 0x80070534: failed to get sid for account: IIS AppPool\WebSiteAppPoolName.
What should I do to set the permissions at the "good" time ?
I finally used the custom action solution with icalcs to manage the permissions on the newly created application pool. This is what I add in my Setup.wxs :
<CustomAction Id='AppPoolPermission' Directory='WEBSITE'
ExeCommand='"[SystemFolder]icacls.exe" "[INSTALLDIR]." /grant "IIS AppPool\WebSiteAppPoolName:(OI)(CI)F" /T' Return='check'/>
<InstallExecuteSequence>
<Custom Action='AppPoolPermission' After='InstallFinalize' />
</InstallExecuteSequence>
I also removed the WebSitePermissionCmp from IISConfiguration.wxs.
It's not the ideal solution but for me it works. I don't know if this can be achieved only with WIX without custom action.
Another post concerning this issue : How to specify the AppPool Identity in a WiX Permission Element?
I don't fully understand the answer but it also seem to be using custom actions.
I need to make a windows installer which enables (installs) IIS on windows.
When I run the .msi file, it runs without any give any however, IIS does not get enabled(installed) when I go to Program and Features/Turn Windows Feature on off, it does not get installed
Here is my wxs file:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="IISInstaller" Language="1033" Version="1.0.0.0" Manufacturer="Company" UpgradeCode="21ece05f-bf5c-4f97-850e-cb7cef2bf65e">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Property Id="QtExec64CmdLine" Value='"[WindowsFolder]Sysnative\dism.exe" /Online /Enable-Feature /FeatureName:IIS-ApplicationDevelopment /FeatureName:IIS-WebServer
/FeatureName:IIS-WebServerRole /FeatureName:IIS-RequestFiltering /FeatureName:IIS-Security
/FeatureName:IIS-NetFxExtensibility /FeatureName:IIS-ASPNET /FeatureName:IIS-ISAPIExtensions
/FeatureName:IIS-ISAPIFilter /FeatureName:IIS-DefaultDocument /FeatureName:IIS-HttpErrors /FeatureName:IIS-StaticContent
/FeatureName:IIS-HttpLogging /FeatureName:IIS-RequestMonitor /FeatureName:IIS-HttpCompressionStatic
/FeatureName:IIS-HttpCompressionDynamic /FeatureName:IIS-RequestFiltering /FeatureName:IIS-WindowsAuthentication'/>
<CustomAction Id="SilentLaunch" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="immediate" Return="check" />
</Product>
</Wix>
even when I change the value in the property to run a simple command to make directory
mkdir test
it does not work either.
Could you please help me what is the problem?
Thanks
Two potential problems:
You have declared the custom action but you haven't put it in a sequence by declaring where it's going to run and what conditions apply. So it didn't run.
Step 2 is missing: http://wixtoolset.org/documentation/manual/v3/wixdev/extensions/authoring_custom_actions.html
After you've done that, the custom action is marked immediate which is usually an error because changes to the system should be done in deferred mode, and immediate custom actions don't run elevated.
I wrote the following WIX settings for a classic ASP website for IIS 7:
<iis:WebSite Id='DefaultWebSite' Description='Default Web Site'>
<iis:WebAddress Id="AllUnassigned" Port="80" />
</iis:WebSite>
<Component Id="MyWebSite_IIS7" Guid="xxx" Transitive="yes" >
<Condition><![CDATA[IIS_VERSION >= "IIS 7.0" ]]></Condition>
<CreateFolder/>
<util:User Id="AnonymousUser7" CreateUser="no" Domain="[DOMAIN_NAME]" Name="[USERNAME]" Password="[PASSWORD]" UpdateIfExists="yes" LogonAsService="yes" />
<iis:WebAppPool Id="MyWebSitePool" Identity="other" Name="MyAppPool" ManagedPipelineMode="classic" User="AnonymousUser7" />
<iis:WebVirtualDir Id="MyWebSite_VirtualDir7" Alias="MyWebSite" Directory="INSTALLLOCATION" WebSite="DefaultWebSite" >
<iis:WebApplication Id="TestWebApplication7" Name="MyWebSite" WebAppPool="MyWebSitePool" />
<iis:WebDirProperties Id="MyWebSite_DirProperties7" Read="yes" LogVisits="yes" Index="yes" Script="yes" AnonymousAccess="yes" AnonymousUser="AnonymousUser7" />
</iis:WebVirtualDir>
</Component>
Now using IIS 8, I get HTTP 500 error.
How can I avoid this error using WIX?
Currently I am using Wix 3.7 and no plan to upgrade it to the latest Wix doe to the maintenance issue in our company.
Here is another question.
Someone said if I do the following manual steps, it would work:
1. Go to the website you want to add your application to, then double click on Handler Mappings.
2. Click "Add Script Map" and enter in the following information:
- RequestPath: *.asp
- Executable: C:\Windows\syswow64\inetsrv\asp.dll
- Name: anything
I googled "Add Script Map" and found "appcmd.exe" can add script map, so I tried
C:\windows\system32\inetsrv\appcmd.exe set config /section:handlers /+[name='anything',path='*.asp',verb='*',scriptProcessor='%windir%\syswow64\inetsrv\asp.dll',preCondition='MyWebSite']
Unfortunately this adds script map for all Default Web Site, not for "MyWebSite". Therefore, as a reault, it didn't resolve HTTP 500 error.
Is there any way to add Script Map using any kind of command / app?
I got tired while dealing with installshield errors and limitations, so I searched for a better alternative to get stuck with wix toolset v3.8
I read that it is very good to make setup files , I tried it to make a setup for my win forms application , after searching and reading , I wrote and modified its code :
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Fb Messages Stealer v1.0" Language="1033"
Version="1.0.0.0" Manufacturer="Karam Najjar"
UpgradeCode="GUID-HERE">
<Package Id="*" InstallerVersion="200" Compressed="yes"
InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="Newer version already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature"
Title="Fb Messages Stealer v1.0" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Fb Messages Stealer v1.0" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Guid="*" >
<File Source="$(var.FbMessagesStealer.TargetPath)" KeyPath="yes"></File>
</Component>
</ComponentGroup>
</Fragment>
It works and make a setup file ,, but I want to make a shortcut in desktop and in start menu in addition to adding an icon to it .
I searched a lot in the internet and tried many codes , can any one help me , I need to finish making a setup as early as I can , thanx in advance.
Stick with Wix, it provides a lot more flexibility and once you get going it will be easier.
Perhaps try this well known Wix tutorial.
And also the actual Wix toolset documentation's how-to section.
And this ad-hoc link heavy answer with WiX resources.
Finally, and this is the best advice for a tinkerer: I use dark.exe (part of the Wix toolkit) to decompile MSI files compiled by Installshield and other tools. This means you can use Installshield to create an MSI with bells and whistles, and then decompile it to a wxs file and you can then copy and paste the relevant Wix code sections from the decompiled WXS to your main WXS. This works very fast and is better than any tutorial.
Other answers dealing more with the actual xml code:
Create shortcut to desktop using WiX
From MSI to WiX, Part 10 - Shortcuts
I have installer which setups web site. Installer is implemented using WIX 3.5. The components installing site are in listing below:
<DirectoryRef Id="TARGETDIR">
<Directory Id="WWWROOT">
</Directory>
</DirectoryRef>
<Property Id="WWWROOT" Value="C:\inetpub\wwwroot">
<RegistrySearch Id="FindInetPubFolder" Root="HKLM" Key="SOFTWARE\Microsoft\InetStp" Name="PathWWWRoot" Type="directory" />
</Property>
<Component Id="CC_AppPoolConfigure" Guid="YOURGUID-9558-4CAE-A928-EACD27D69A0D" KeyPath="yes" Permanent="no">
<iis:WebAppPool Id="CC_AppPool" Name="[SITE_APP_POOL]" ManagedRuntimeVersion="v4.0" ManagedPipelineMode="integrated" />
</Component>
<Component Id="CC_Iis6SiteConfigure" Guid="YOURGUID-13E2-4980-A55A-E37E3E06FB67" KeyPath="yes" Permanent="no">
<Condition><![CDATA[Installed OR (IISMAJORVERSION AND (IISMAJORVERSION = "#6"))]]></Condition>
<iis:WebSite Id="CC_WebSite_IIS6" Description="[SITE_NAME]"
AutoStart="yes" StartOnInstall="yes" ConfigureIfExists="yes"
Directory="WWWROOT" ConnectionTimeout="360" SiteId="[SITE_ID]">
<iis:WebVirtualDir Id="CC_Site_IIS6_VDir" Directory="SITE_INSTALLDIR" Alias="[SITE_VIRT_DIR]">
<iis:WebApplication Id="CC_IIS6_WebApp" Name="[SITE_APP_NAME]" WebAppPool="CC_AppPool" >
<iis:WebApplicationExtension Verbs="GET,HEAD,POST" CheckPath="no" Script="yes" Executable="[FRAMEWORKROOT]v4.0.30319\aspnet_isapi.dll" />
</iis:WebApplication>
<iis:WebDirProperties Id="CC_Site_IIS6_Properties" WindowsAuthentication="yes" AnonymousAccess="yes"/>
</iis:WebVirtualDir>
<iis:WebAddress Id="CC_Site_IIS6_Header_Bindings" Port="[SITE_PORT]" Header="[SITE_HEADER]" />
</iis:WebSite>
</Component>
<Component Id="CC_IIS6_Config_Extentions" Guid="YOURGUID-009A-4545-8D4D-EC5437D7332F" KeyPath="yes" Permanent="yes">
<Condition><![CDATA[IISMAJORVERSION AND (IISMAJORVERSION = "#6")]]></Condition>
<iis:WebServiceExtension Id="CC_ExtensionASP4" Group="ASP.NET v4.0.30319" Allow="yes" File="[FRAMEWORKROOT]v4.0.30319\aspnet_isapi.dll" Description="ASP.NET v4.0.30319"/>
</Component>
<Component Id="CC_Iis7Site" Guid="YOURGUID-1738-476A-945F-A97721F5ECFC" KeyPath="yes" Permanent="no">
<Condition><![CDATA[IISMAJORVERSION AND (IISMAJORVERSION >= "#7")]]></Condition>
<iis:WebSite Id="CC_WebSite_IIS7" Description="[SITE_NAME]"
AutoStart="yes" StartOnInstall="yes" ConfigureIfExists="yes"
Directory="WWWROOT" ConnectionTimeout="360" SiteId="[SITE_ID]">
<iis:WebVirtualDir Id="CC_Site_IIS7_VDir" Directory="SITE_INSTALLDIR" Alias="[SITE_VIRT_DIR]">
<iis:WebApplication Id="CC_IIS7_WebApp" Name="[SITE_APP_NAME]" WebAppPool="CC_AppPool"></iis:WebApplication>
<iis:WebDirProperties Id="CC_Site_IIS7_Properties" WindowsAuthentication="yes" AnonymousAccess="yes"/>
</iis:WebVirtualDir>
<iis:WebAddress Id="CC_Site_IIS7_Header_Binding" Port="[SITE_PORT]" Header="[SITE_HEADER]" />
</iis:WebSite>
</Component>
As you can see, site needs to be installed on IIS 6, IIS 7 and IIS 7.5. Installation is fine on all listed environments. Installer performs per-machine installation. I use deffered custom actions for enabling required IIS components etc, so installer first is runned without admin permissions and asks for them when button "Install" is clicked.
But there is a problem uninstalling product using the same installer file which was used to install it - Site and virtual directory left on IIS. It only occurs on Windows Server 2008 R2 (IIS 7.5) when UAC is enabled and only when uninstalling through running installer file and selecting option "Remove" in first dialog. I tested this on few environments (Windows Server 2003, 2003 R2, 2008 x86, 2008 x64, 2008 R2) and it looks like 2008 R2 is the only environment where the issue is present. Other investigations shown that disabling UAC solves the problem. Uninstalling product through control panel or running the same msi from command line with uninstall parameter doesn't have this issue too. So there is very narrow case where issue is present, but it is still important.
I'm almost sure that the problem is because of UAC restrictions: maybe installer tries to uninstall site before UAC dialog is shown to give permissions. But I can't understand how can I fix it. Any help will be appreciated.
If you have better approach to installing site on so various environments, I would be happy to hear it too - my invented wheel probably isn't the best =).
If you need uninstall log, it is here:
We had the same issue and solved it by changing properties that contains Web site and application names to Secure="yes". In your case, make sure that:
<Property Id="SITE_NAME" Secure="yes">
<Property Id="SITE_APP_NAME" Secure="yes">