1

I'm attempting to install a dll shared by multiple projects to the GAC, using Visual Studio's setup and deployment project. I've strongly named my assembly, and set the output folder of the project primary output to 'Global Assembly Cache folder'.

Strongly named assembly capture

Project output properties capture

File System of Setup Project

After building and installing the executable, I've received no errors. However, using the GacUtil, I can confirm that the dll was not added to the GAC. What am I missing?

I've scoured Stackoverflow and other sources, but haven't found an explanation.

GAC Util output

  • Not entirely clear if you have right clicked the ***"File System on Target Machine"*** top node and done **`Add Special Folder`** **`=>`** **`Global Assembly Cache Folder`**? I am not up to speed on [the new GAC](https://stackoverflow.com/q/2660355/129130). Recommend you go for [WiX or another tool](https://stackoverflow.com/a/50229840/129130) ([some reasons why](https://stackoverflow.com/a/47944893/129130)). And here is a [WiX quick-start tip collection](https://stackoverflow.com/a/25005864/129130). – Stein Åsmul Aug 29 '19 at 00:03
  • Yes, I have followed the steps you mentioned to add the special folder 'Global Assembly Cache Folder'. I'll add a screenshot of the File System of my project to my original question. – AllisonCamp Aug 29 '19 at 14:35

2 Answers2

0

Assembly Tables: I'll just add an attempted answer, no time to test. In the compiled MSI of yours, is there anything in the tables MsiAssembly and MsiAssemblyName? Are the tables there at all? And it seems manual installation to the GAC works fine? (so no strong name issues).

GAC Folder: Not entirely clear if you have right clicked the "File System on Target Machine" top node and done Add Special Folder => Global Assembly Cache Folder?

GAC

"Add Assembly...": Make sure you add the file as an assembly as illustrated here, and add it to the Global Assembly Cache folder:

Assembly

A Tale of Two GACs: I am not up to speed on the new GAC. Just an issue to be aware of and test. How to view the Folder and Files in GAC?:

  • .NET 1.0 - NET 3.5: c:\windows\assembly (%systemroot%\assembly)
  • .NET 4.x: %windir%\Microsoft.NET\assembly

Alternative Tools: Recommend you go for WiX or another tool. And yes, there are some good reasons why. Here is a WiX quick-start tip collection. Advanced Installer has some free features for simple requirements.


Links:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • Do you have any resources for checking the MsiAssembly and MsiAssemblyName tables of a compiled MSI? – AllisonCamp Aug 29 '19 at 14:44
  • Yes, you install Orca - Microsoft's own MSI viewer and editor. It is in the SDK and hence installed with Visual Studio. I describe it here: [Tools for comparing and viewing MSI files](https://stackoverflow.com/questions/48482545/how-can-i-compare-the-content-of-two-or-more-msi-files/48482546#48482546). Try searching for ``Orca-x86_en-us.msi`` - under ``Program Files (x86)`` and install the MSI if found. Current path for me: **`C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86`**. – Stein Åsmul Aug 29 '19 at 17:02
  • Please see updates above with regards to the two different GAC locations on disk. – Stein Åsmul Aug 29 '19 at 17:28
  • Thank you for the updates! I have checked both GAC locations for the assembly, and it is not listed. I've checked the MsiAssemblyName table and my dll is missing there as well. – AllisonCamp Aug 29 '19 at 18:31
  • Added one more screen shot above. Please give it a try. – Stein Åsmul Aug 29 '19 at 19:35
  • Unfortunately, this did not resolve my issue. As a request for clarification: an assembly can only be installed on either the program target directory OR the GAC, correct? – AllisonCamp Aug 29 '19 at 19:49
  • You should be able to install to both, but only strong named assemblies can make it into the GAC. I am not sure how these project types do things. I got it working here. Tell you what, why don't you test with this [test assembly from Phil Wilson (MSI expert)](https://github.com/Apress/def-guide-to-win-installer/tree/024a4a8657ab8135db9974a9b9b99a79b35b9da0/Chapter08/GACInstall/bin/Release). It has the proper strong name that you need to do a successful GAC-install. – Stein Åsmul Aug 29 '19 at 19:53
  • I'll take a look. In the meantime, do you have any informative resources on WiX, outside of the Wix.org tutorials? I might as well learn how to use it, as this isn't the most frustrating issue I've come across with the Setup/deployment project. – AllisonCamp Aug 29 '19 at 20:51
  • The [*"WiX quick-start tip collection"* link](https://stackoverflow.com/a/25005864/129130) above (and repeated here) has a number of links and pointers to resources for learning WiX. You can also use the WiX toolkit's `dark.exe` to decompile an MSI to WiX XML markup. That can yield a head-start. – Stein Åsmul Aug 29 '19 at 21:04
  • Thank you so much for your help with this! And thank you for sending the Github example; that was particularly useful. Apparently, if I create a separate setup project to install the component with the GAC-bound dll, it works. I'll mark this as answered. – AllisonCamp Aug 29 '19 at 21:53
0

Creating a separate setup project for the dll allowed successful installation of the assembly to the Global Assembly Cache. Therefore, the issue I was experiencing was most likely due to something in my original project, which included a large host of outputs. I'll most likely keep the assembly in its own installer and use this installer as a required prerequisite for applications that expect the assembly.

Thank you Stein for the fantastic resources. I hope this thread helps other users in the future.