2011-06-04 19 views
3

我使用InnoSetup来安装我建立的应用程序。我的客户端请求,它下载最新的DLL。一旦使用该插件InnoSetup安装:我可以使用Pascal脚本(InnoSetup)向GAC注册吗?

http://www.sherlocksoftware.org/page.php?id=50

够简单。我的工作方式如何,但没有[Files]部分(因为它下载它们而不是将它们构建到脚本中),我不知道如何将下载的DLL注册到GAC。随着[Files]节的介绍,我正在使用国旗gacinstall

现在我不再使用[Files],我想知道是否有方法通过Pascal脚本将这些DLL安装到GAC中?

这里是我的安装脚本中的相关部分:

[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 

感谢您的帮助。

回答

2

[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; 

那么你不需要你来CurStepChanged召唤为[Files]节将照顾这对你。

从Pascal脚本中,您可以使用GAC API。

这是没有正式记录,这里有一些文章做了很好的报道。

  1. http://support.microsoft.com/default.aspx?scid=kb;en-us;317540
  2. http://www.codeproject.com/KB/system/gacapi.aspx
  3. http://www.codeproject.com/KB/dotnet/undocumentedfusion.aspx

你可以建立自己的东西来调用API,或者你可以分发this application,并通过调用Exec,或者ShellExec使用它。

这里是Delphi CodeCVS log)导入InnoSetup内部使用的融合DLL。

+0

更新为我意识到可以使用'[Files]'部分。 – 2011-06-06 03:13:20

0

如果你可以调用.NET代码,您可以使用注册程序集到GAC:

System.EnterpriseServices.Internal.Publish.GacInstall(string path) 

这是在System.EnterpriseServices组装功能。

+0

InnoSetup产生本机代码安装。所以你可以做到这一点,但必须将这个调用包装到一个可以被称为.NET的接口中 – 2011-06-06 16:11:04

相关问题