views:

363

answers:

2

I'd like to detect in WiX 3 (preferably via a Condition) whether a particular assembly is in the GAC. I know the name, version, and public key token of said assembly. Is there any built in way to do this, or will I have to write a CustomAction to do it? And how would I go about setting up that CustomAction? (This would be before the install begins.)

+2  A: 

You can use FileSearch to search for the file in %windir%\assembly\GAC (If you know all the other values) a bit hacky but works.
The full file path will be stored inside a property which you can use in condition before the install start.

Shay Erlichmen
Works for me. Seems a little hacky to go to the GAC directory directly, but it's fairly clean of an approach otherwise. The directories are named by name, version, and public key token, which is conveniently exactly what I have.
Promit
+1  A: 

Need to be careful. Assemblies can be installed in more than just the %windir%\assembly\GAC folder. My assemblies are most often installed in the %windir%\assembly\GAC_MSIL. Just search the %windir%\assembly\ and you should be ok.

Cody