How can I install one publisher policy in the GAC using WIX?

What would be the appropriate way to install one publisher policy in 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, this error appears:

policy.1.0.ClassLibrary1.dll seems to be invalid. Verify that this is a valid assembly file and that the user has the appropriate permissions to the file. Additional Information: HRESULT: 0x8013101b

And finally, when compiling with VS2010, there are no problems. But at the end of the installation process, the DLL was well installed and there was no publisher policy. I also read the log created during the installation, and I could not find the reason.

Thank you for reading.

+4
source share
3 answers

I did something similar and worked well with Visual Studio 2010 and on the 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 a policy.config file in the same project directory and I create a policy dll in the same release to simplify the installation of the script.

I noticed that the policy component must have a directive and, for some reason, it internally requires that the policy DLLs and configuration files be in the same directory / component.

I am building a policy assembly in the MiClass project's Post-Build event 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.

+2
source

I have done some work with political dlls, and the only difference I see is that the file naming convention is slightly different from ours.

Instead

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

We used

 policy.1.0.ClassLibrary1.dll ClassLibrary1.dll.config 
0
source

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

0
source

All Articles