Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WiX remove default IIS website before creating a new one

Tags:

iis

wix

wix3.7

I created a WiX package for my website, and it works fine, except that my newly created website doesn't start after installation. That's because my website is registered to use *:80. IIS by default has a website setup with the same binding.

Is there a way to remove default website (or at least stop it) before creating my new website binding? I can't seem to find any information for this on the internet, but it seems like a common problem.

like image 452
Ilya Volodin Avatar asked Feb 24 '14 16:02

Ilya Volodin


1 Answers

I found how to do this, I thought I'd put an answer for any weary travelers:

<CustomAction Id="RegisterCommand"
              Property="RegisterPowerShellProperty"
                                Execute="immediate"
                                Value="&quot;C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe&quot; -ExecutionPolicy ByPass -NoLog -InputFormat None -NoProfile -command &quot;Remove-IISSite -Name 'Default Web Site' -Confirm:$false&quot;"/>
<CustomAction Id="RegisterPowerShellProperty"
              BinaryKey="WixCA"
              DllEntry="CAQuietExec64"
              Execute="deferred"
              Return="check"
              Impersonate="no" />

<InstallExecuteSequence>
        <Custom Action="RegisterCommand" After="CostFinalize">NOT Installed</Custom>
       <Custom Action="RegisterPowerShellProperty" After="InstallFiles">NOT  Installed</Custom>     
</InstallExecuteSequence>

My answer was based off this article: here

like image 58
JohnChris Avatar answered Oct 20 '22 02:10

JohnChris