1

I'm developing a simple installer using WiX on which I'm trying to install a .dll and a publisher policy on GAC.

I successfully add the .dll on GAC using the installer. But I want to use PostBuild events from Visual Studio to execute msbuild commands. The order of the things I need to do is:

  1. Create the publisher policy on a Post build event of Visual Studio.

  2. Execute the command al /link:the.config /out:the.policy.dll /keyfile:thekey.snk /platform:x86

  3. Publish the policy using a specific GACUTIL.

If I'm correct, if I execute gacutil -i Policy.1.0.TestLibrary.dll, Visual Studio will install this policy on the new GAC1, and I want to use the older one2.

How can I tell Visual Studio to use a specific gacutil on a Post Build event?

I tried this for PostBuild events:

al /link:"$(SolutionDir)"TestLibrary.dll.config /out:"$(SolutionDir)"Policy.1.0.TestLibrary.dll /keyfile:"$(SolutionDir)"sgKey.snk /platform:x86

But get The command "...." exited with code 9009.

Also, if I publish Library.v1.0.dll on the old GAC, and then I install Library.v2.0.dll on the new GAC, if I create a publisher policy from v1.0 to v2.0, will they find each other?

[1]: GAC used for .Net Framework 4.0 and above.
[2]: GAC used for .Net Framework 3.5 and below.

Rob Mensching
  • 33,834
  • 5
  • 90
  • 130
Sonhja
  • 8,230
  • 20
  • 73
  • 131
  • Just specify the full path of the gacutil.exe version you want to use. Like C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\gacutil.exe. Running gacutil.exe on your dev machine is a Very Bad Idea btw. Also quite useless to test anything, the customer's machine won't have gacutil.exe available. – Hans Passant May 16 '13 at 17:26
  • I agree. I ended up building my own policy with the desired gacutil and inserting policy and library manually on WiX. – Sonhja May 17 '13 at 09:02

1 Answers1

0

The problem was solved. There was an inconsistency on the policy, and that's why it wasn't working...

Sonhja
  • 8,230
  • 20
  • 73
  • 131