Adding assemblies to the GAC from Inno Setup

5.3k views Asked by At

I am developing some XBAP Applications that uses Fluent nHibernate and mshtml.

The problem is:

The size of the nHibernate.dll (2.080 KB) and Microsoft.mshtml.dll (7.826 KB)

I would like to create a Pre-requisites installer to my application, so it copies these files to GAC. So all my XBAPs that use these files can find them in GAC, and have the Publish folder size reduced to just the XBAP dlls.

Could somebody put an Inno Setup Example Script that does copies these assemblies to GAC?

1

There are 1 answers

1
Tony On BEST ANSWER

My XBAP Publish was about 11 MB now it is about only 1.7 MB.

I used this Inno Setup Script (.iss):

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Company"
#define MyAppVersion "2.0"
#define MyAppPublisher "Tony Sistemas"
#define MyAppURL "http://www.tonysistemas.com.br/"
#define MyAppExeName "Initialize.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{2DF12035-BD5C-4F86-90D3-00ACA5A30279}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=instalar
Compression=lzma
SolidCompression=yes

[Languages]
Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"

[Tasks]
;Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
;Source: "C:\Program Files\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
;Source: "C:\Users\Tony\Desktop\C#\Setup\Microsoft.mshtml.dll"; DestDir: "C:\Windows\assembly"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: "C:\Users\Tony\Desktop\C#\Setup\Microsoft.mshtml.dll"; DestDir: "{app}"; StrongAssemblyName: "Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A, ProcessorArchitecture=MSIL"; Flags: "gacinstall sharedfile uninsnosharedfileprompt"
Source: "C:\Users\Tony\Desktop\C#\Setup\NHibernate.dll"; DestDir: "{app}"; StrongAssemblyName: "NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=AA95F207798DFDB4, ProcessorArchitecture=MSIL"; Flags: "gacinstall sharedfile uninsnosharedfileprompt"
Source: "C:\Users\Tony\Desktop\C#\Setup\FluentNHibernate.dll"; DestDir: "{app}"; StrongAssemblyName: "FluentNHibernate, Version=1.1.0.685, Culture=neutral, PublicKeyToken=8AA435E3CB308880, ProcessorArchitecture=MSIL"; Flags: "gacinstall sharedfile uninsnosharedfileprompt"
Source: "C:\Users\Tony\Desktop\C#\Setup\WPFVisifire.Charts.dll"; DestDir: "{app}"; StrongAssemblyName: "WPFVisifire.Charts, Version=2.2.4.0, Culture=neutral, PublicKeyToken=99D724542E4DB593, ProcessorArchitecture=MSIL"; Flags: "gacinstall sharedfile uninsnosharedfileprompt"

Source: "C:\Users\Tony\Desktop\C#\Setup\MySql.Data.dll"; DestDir: "{app}"; StrongAssemblyName: "MySql.Data, Version=6.3.4.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D, ProcessorArchitecture=MSIL"; Flags: "gacinstall sharedfile uninsnosharedfileprompt"
Source: "C:\Users\Tony\Desktop\C#\Setup\WPFToolkit.dll"; DestDir: "{app}"; StrongAssemblyName: "WPFToolkit, Version=3.5.40128.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35, ProcessorArchitecture=MSIL"; Flags: "gacinstall sharedfile uninsnosharedfileprompt"