Which would be the proper way to install one publisher policy in to the GAC using WIX?

4

Which would be the proper way to install one publisher policy in to the GAC using WIX 3.5?

I tried to do this:

      <File
            Id="LIBGAC"
            Assembly=".net"
            KeyPath="yes"
            Vital="yes"
            Name="ClassLibrary1.dll"
            ProcessorArchitecture="msil"
            DiskId="1"
            Source="..\ClassLibrary1\bin\Release\ClassLibrary1.dll"  >
      </File>
    </Component>
    <Component Id="Config"  Guid="F089B1AA-B593-4662-9DF4-F47EB9FBA1F4"  >
      <File
            Id="LIBGACPolicy"
            Assembly=".net"
            KeyPath="yes"
            Vital="yes"
            Name="Policy.1.0.ClassLibrary1.dll"
            DiskId="1"
            Source="..\ClassLibrary1\policy.1.0.ClassLibrary1.dll"  >
      </File>
      <File 
            Id="LIBGACPolicyConfig" 
            Source="..\ClassLibrary1\policy.1.0.ClassLibrary1.config" 
            CompanionFile="LIBGACPolicy">
      </File>
    </Component>
  </Directory>

When compiling with VS2008 appears this error:

policy.1.0.ClassLibrary1.dll appears to be invalid. Please ensure this is a valid assembly file and that the user has the appropriate access rights to this file. More information: HRESULT: 0x8013101b

And lastly, when compiling with VS2010 doesn´t appear to be any problem. But at finalizing the installation process, the DLL is well installed and the publisher policy didn´t. Also I read the log generated during the installation and I wasn´t able to find a cause.

Thanks for reading.

wix
gac
wix3.5
publisher-policy
asked on Stack Overflow Oct 17, 2011 by Luis • edited Dec 5, 2016 by Flexicoder

3 Answers

2

I've been doing something similar and works well using Visual Studio 2010 and in a Build Server with MsBuild:

<Directory Id="TARGETDIR" Name="SourceDir">
   <Directory Id="ProgramFilesFolder">
      <Directory Id="Gac" Name="Gac">
         <!-- The component with the assembly -->
         <Component Id="MiClassDLL" Guid="*">
            <File Id="MiClass.dll" Assembly=".net" KeyPath="yes"
                  Source="$(var.MiClass.TargetPath)" />
         </Component>
         <!-- The component with the policy -->
         <Component Id="PolicyMiClassDLL" Guid="{YOUR_GUID_HERE}">
            <File Id="PolicyMiClass.dll" KeyPath="yes"
                  Source="$(var.MiClass.TargetDir)Policy.1.0.MiClass.dll" />
            <File Id="PolicyMiClass.config" KeyPath="no"
                  Source="$(var.MiClass.ProjectDir)Policy.1.0.MiClass.config" />

         </Component>
      </Directory>
   </Directory>        
</Directory

In my case I have the policy.config file in the same project directory and I build the policy dll in the same output to make easier the installer script.

I noticed that the policy component must have a guid and for some reason it requires internally that policy dll and config files in the same directory/component.

I build the policy assembly in the Post-Build event of MiClass project with this command:

"C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\al.exe"
    /link:"$(ProjectDir)Policy.1.0.MiClass.config"
    /out:"$(TargetDir)Policy.1.0.MiClass.dll"
    /keyfile:"$(SolutionDir)MyKeys.snk"
    /comp:"My Company"
    /prod:"My Product" 
    /productv:1.0 
    /version:1.0.0.0

I hope this works for you.

answered on Stack Overflow May 17, 2012 by oarrivi
0

I did some work with policy dlls, and the only difference I can see is that your file naming convention is a little different than ours was.

Instead of

policy.1.0.ClassLibrary1.dll
policy.1.0.ClassLibrary1.config

We used

policy.1.0.ClassLibrary1.dll
ClassLibrary1.dll.config
answered on Stack Overflow Oct 18, 2011 by Dave Andersen
0

instead of /link switch use /embed to compile the xml-config into publisher policy. then you can install the resulting assembly into GAC without problems

answered on Stack Overflow Aug 14, 2013 by Kakash1hatake

User contributions licensed under CC BY-SA 3.0