I have an advanced installer project which installs a strong-named assembly into the global assembly cache. I use the "assemblies" section of the installer UI to to do this.
When the product is uninstalled, the assembly is never removed from the GAC. This happens even if I install and then immediately uninstall (i.e, uninstall before any application has a chance to reference the new assembly).
At first I thought this was a bug with my installer project (which uses a merge module to install the assembly). But I was able to reproduce this problem by creating a simple test installer that does nothing but install an assembly in the GAC.
I'm using AI 4.6.4 on XP Home service pack 2. I reproduced the problem with my test installer on another computer with XP Pro service pack 2.
I've been putting off upgrading AI for a while, because we're about to do a release and I don't really want to change the installer program unless I have to.
Here are my steps to reproduce. If you want I can send you the .msi/.aip files.
Create a GACable dll (requires visual C# Express edition)
1) Start C# Express
2) Select File->New Project
3) Select Class Library, in the Name box it will probably be called ClassLibrary1 which is fine
4) Click OK
5) In the solution explorer, right click on the project
6) Select Properties
7) Select Signing
8) Check Sign the Assembly
9) Under Choose a new strong name key file, select New
10) Enter a Key name, such as Foo, and uncheck "Protect with a password"
11) Click OK
12) Click File->Save All and save the solution, note the directory name where it is saved
13) Click Build->Build Solution
Now we have our GAC-able dll. Next, create the AI project:
1) Start Advanced Installer
2) Select "Enterprise" in the New Project dialog, use the wizard to create the project
3) Hit Next twice
4) Click Browse to locate the application folder. This folder is the "bin\Debug" folder of the solution directory we created in step 12 above
5) Click Finish
6) Save the installer file somewhere
7) When AI finishes building, click Assemblies
8) Right click in the assemblies pane and select Add Assembly
9) Double click on the ClassLibrary1 dll, which should be listed
10) Make sure destination says "Install in Global Assembly Cache"
11) Make sure type says ".Net assembly"
12) Click Run to build and run the installer, and complete the install of the dll
13) Click Run again from advanced installer, select "Remove" in the install to remove the dll
14) Click Start->Run, and type in "c:\windows\assembly" (choose a different drive if your windows is on a different drive)
15) Observe that ClassLibrary1 is still listed in the GAC (you can right click it at this point to manually uninstall)
.Net 2.0 assemblies requires the "ProcessorArchitecture" attribute in order to be uninstalled. Add this attribute to the "Attributes" list of the "Assemblies" properties page with the proper value (X86, Amd64, MSIL, etc).
This attribute corresponds to the platform for which the assembly has been built and has one of the following values:
Amd64 -- A 64-bit AMD processor only.
IA64 -- A 64-bit Intel processor only.
MSIL -- Neutral with respect to processor and bits-per-word.
None -- An unknown or unspecified combination of processor and bits-per-word.
X86 -- A 32-bit Intel processor, either native or in the Windows on Windows (WOW) environment on a 64-bit platform
In a future version of Advanced Installer this attribute will be added automatically.
FOLLOW US
Get the latest news in Application Packaging