1

I'm using Inno Setup 6 as an installer creator. I have an ASP.NET code that I need to extract on a local computer that is running Windows 10 and create a web application pointing to that extract on a local IIS 10.

I tried an answer from 10 years ago but that seems to be too old as it apply to IIS 6 and throws an exception in Windows 10.

I tried having Inno Setup script:

[Run]
Filename: "powershell.exe"; Description: "Deploy WebApi"; Parameters: "-ExecutionPolicy Bypass -File ""{app}\webapi\webapi_deploy.ps1 {app}\webapi"""; WorkingDir: {app}\webapi ; Flags: nowait postinstall skipifsilent

execute a powershell script:

New-WebApplication -Name "my-webap" -Site "Default Web Site" -PhysicalPath $webapiPhysicalPath -ApplicationPool "DefaultAppPool" -force

but the physical path does not pass from inno setup to the powershell script.

  1. Is there an installer, Inno setup or other that deploys code to IIS as a web application?
  2. Is there a way in Inno Setup to pass the extracted code path to the powershell script?
  • 1
    You can find detailed examples, https://stackoverflow.com/questions/11830183/inno-setup-iis-installation-and-configuration Since you want to expand constants, you'd better do that in Pascal code. – Lex Li Aug 10 '21 at 13:57
  • Lex, thanks for the prompt reply. The code samples from inno setup do work when trying to create a web application that is made of a single static html file, but when inno setup tries to create my asp.net web application, it throws an exception at vDir.AppCreate(True); and there is not exception information . – Yaron Habot Aug 10 '21 at 14:03
  • You should follow examples that use either `appcmd` or PowerShell to manipulate IIS settings (for IIS 7 and above). Other legacy API should be avoided now as IIS 6 is long dead. – Lex Li Aug 10 '21 at 14:06
  • `appcmd` is working! Problem is solved. Many thanks. – Yaron Habot Aug 10 '21 at 14:28
  • just publish the applcation to a local web folder. At that point, only a folder copy is required. (and Inno can do that if you want). So you can use a batch file, WinZip, or Inno, but ALL YOU are doing is copying a plane jane folder to the target machine. So, publish your .net project to a local folder, and have Inno then use that folder as the project source - it really only a simple folder copy for this to work. I see ZERO need for power-shell - all you need is a simple folder copy. – Albert D. Kallal Aug 10 '21 at 16:28
  • "I see ZERO need for power-shell" requires a lot of fortune (like IIS must be properly installed, and a site has already been configured there), but real world installers can hardly make such assumptions. – Lex Li Aug 10 '21 at 17:21

0 Answers0