So recently I've built a .msi
file and I have no problem installing by double clicking on it.
However when I try to silent install it in command prompt msiexec /i product.msi /qn
there will be privilege error:
Error 1303. The installer has insufficient privileges to access this directory: C:\Program Files (x86)\Company. The installation cannot continue. Log on as administrator or contact your system administrator.
One solution I found is set InstallScope="perMachine"
under package element but it's not working for me because I'll get another privilege error
After some googling I realized I can install it with elevated command prompt, but I'm still wondering whether I can install it without elevated command prompt
below is roughly what my .wxs
looks like:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Name="Product" Manufacturer="Company" Version="1.0.0"
Id="GUID"
UpgradeCode="GUID"
Language="1033" Codepage="1252">
<Package Id="*" Compressed="yes"/>
<Condition Message="This application only support 64-bit Windows OS">VersionNT64</Condition>
<!-- for some reason these are necessary -->
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="Acme's Foobar 1.0 Installation [1]" />
<!-- Step 1: Define the directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="ProgramFilesFolderCompany" Name="Company">
<Directory Id="INSTALLDIR" Name="Product"/>
</Directory>
</Directory>
</Directory>
<!-- Step 2: Add files to your installer package -->
<DirectoryRef Id="INSTALLDIR">
<Component Id="MainExecutable" Guid="GUID">
<File Id="MainExecutableEXE" Source="product.exe" KeyPath="yes" Checksum="yes"/>
</Component>
</DirectoryRef>
<!-- Step 3: Tell WiX to install the files -->
<Feature Id="Complete" Level="1">
<ComponentRef Id="MainExecutable" />
<ComponentGroupRef Id="Examples" />
<ComponentGroupRef Id="Scripts" />
</Feature>
</Product>
</Wix>
Thanks for the help!