[英]Can I register to the GAC with Pascal scripting (InnoSetup)?
I'm using InnoSetup to install an application I built.我正在使用 InnoSetup 安装我构建的应用程序。 My client requests that it downloads the latest DLLs upon install using this InnoSetup addon:
我的客户要求它在使用此 InnoSetup 插件安装时下载最新的 DLL:
http://www.sherlocksoftware.org/page.php?id=50 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.
我让它按我想要的方式工作,但是没有[Files]部分(因为它下载它们而不是将它们构建到脚本中),我不确定如何将下载的 DLL 注册到 GAC。 With the [Files] section in, I was using the flag gacinstall .
在[Files]部分中,我使用了标志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?现在我不再使用[Files] ,我想知道是否有办法通过 Pascal 脚本将 DLL 安装到 GAC?
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]
部分,您可以使用external
标志来允许您下载的文件通过标准[Files]
部分运行,其中gacinstall
标志可用。
[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.然后,您不需要调用
CurStepChanged
,因为[Files]
部分会为您处理这些问题。
From the Pascal Scripting you could use the GAC API.在 Pascal 脚本中,您可以使用 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
.你可以自己构建一些东西来调用 API 或者你可以分发这个应用程序并通过调用
Exec
或ShellExec
来使用它。
Here is the Delphi Code ( CVS log ) to importing the fusion DLL that InnoSetup uses internally.这是导入 InnoSetup 内部使用的融合 DLL 的Delphi 代码( CVS 日志)。
If you can call into .NET code, you can register assemblies to the GAC using:如果您可以调用 .NET 代码,您可以使用以下方法向 GAC 注册程序集:
System.EnterpriseServices.Internal.Publish.GacInstall(string path)
which is available in the System.EnterpriseServices
assembly.这在
System.EnterpriseServices
程序集中可用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.