I'm using InnoSetup to install an application I built. My client requests that it downloads the latest DLLs upon install using this InnoSetup addon:
http://www.sherlocksoftware.org/page.php?id=50
Simple enough. I got it working how I want to, but without the [Files] section (because its downloading them rather than building them into the script), I'm not sure how to register the downloaded DLLs to the GAC. With the [Files] section in, I was using the flag gacinstall.
Now that I'm no longer using [Files], I was wondering if there was a way to install the DLLs to the GAC via Pascal scripting?
Here is the relevant part of my setup script:
[Code]
procedure InitializeWizard();
begin
itd_init;
itd_addfile('{#DownloadLocation}/mylibrary1.dll',expandconstant('{tmp}\mylibrary1.dll'));
itd_addfile('{#DownloadLocation}/mylibrary2.dll',expandconstant('{tmp}\mylibrary1.dll'));
itd_downloadafter(wpReady);
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssInstall then begin //Lets install those files that were downloaded for us
filecopy(expandconstant('{tmp}\mylibrary1.dll'),expandconstant('{app}\mylibrary1.dll'),false);
filecopy(expandconstant('{tmp}\mylibrary2.dll'),expandconstant('{app}\mylibrary2.dll'),false);
end;
end;
[Run]
Filename: "{app}\{#MyAppExeName}"; Parameters: "-i"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, "&", "&&")}}"; Flags: runhidden
Filename: "{app}\{#MyAppSvcName}"; Parameters: "-i"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, "&", "&&")}}"; Flags: runhidden
Filename: "{app}\{#MyAppExeName}"; Description: "Launch the ItraceIT configuration tool"; Flags: postinstall nowait skipifsilent
[UninstallRun]
Filename: "{app}\{#MyAppSvcName}"; Parameters: "-u"; Flags: runhidden
Filename: "{app}\{#MyAppExeName}"; Parameters: "-u"; Flags: runhidden
Thanks for your help.
The [Files] Section, you can use the external flag to allow the files
that you have downloaded to run through the standard [Files] section, where the gacinstall flag is available.
[Files]
Source:{tmp}\mylibrary1.dll; DestDir:{app}; StrongAssemblyName: "MyAssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=abcdef123456, ProcessorArchitecture=MSIL" Flags: external; gacinstall;
Then you don't need your call to CurStepChanged as the [Files] section will take care of that for you.
From the Pascal Scripting you could use the GAC API.
It's not officially documented, here are some articles that do a good job of covering it.
You could build something yourself to Call the API or you could distribute this application and use it by calling Exec, or ShellExec.
Here is the Delphi Code (CVS log) to importing the fusion DLL that InnoSetup uses internally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With