Error adding policy file to GAC

I am trying to add a publisher policy file to gac according to this thread , but I am having problems when I try to add the file to my test server.

I am getting "The module specified in the assembly manifest" policy.3.0.assemblyname.dll "was not found"

My policy file looks like this:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="*assemblyname*"
                          publicKeyToken="7a19eec6f55e2f84"
                          culture="neutral" />
        <bindingRedirect oldVersion="3.0.0.0"
                         newVersion="3.0.0.1"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

      

Please, help!

thank

Ben


I recreated the problem from scratch with a new build that has no dependency (other than the default) - everything works fine on my local development machine (and redirects too too), but gives the same error adding the policy file to the GAC on the server!

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="TestAsm"
                          publicKeyToken="5f55456fdcc9b528"
                          culture="neutral" />
        <bindingRedirect oldVersion="3.0.0.0"
                         newVersion="3.0.0.1"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

      

related as follows

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\al.exe /link:PublisherPolicy.xml /out:policy.3.0.TestAsm.dll /keyfile:..\..\key.snk /version:3.0.0.0
pause

      

Please, help!

0


source to share


3 answers


Wow - ok got it.

I should have paid more attention to what it meant

(MSDN) How to Create a Publisher Policy



Important note: an assembly's publisher policy cannot be added to the global prefab cache if the original publisher policy file is in the same directory as the assembly.

This requirement, frankly, is so strange that it has not been registered. The original policy file that was compiled into the assembly I'm trying to add to gac should be in the same folder as the policy assembly when you add the policy assembly.

+2


source


Ok ... just want to check some basics ...

Do you definitely have both versions of the GAC dependent assembly installed?

And you have verified that the version numbers are correct in the [assembly: AssemblyVersion ()] attribute.

And you used [assembly: AssemblyVersion ()] and NOT [assembly: AssemblyFileVersion ("1.0.0.1")].



Update: . My mistake: you only need the latest build in the GAC. I just tried it here and it works. My only thought is to verify that the public key tokens are the same and that you haven't misspelled the assembly name.

Also, when you create the policy file, make sure you use the / version switch in the build linker to explicitly set the version number to 3.0.0.0 and not specify the / platform switch. eg.

al.exe /link:assembly.config /out:policy.3.0.assembly.dll 
         /keyfile:mykey.snk /version:3.0.0.0

      

+1


source


To add policy assemblies to the GAC using Wise, you do the same as you add the assembly that the policy is for. So you add the policy assembly to the "Global Assembly Cache" under "Wise", and as long as you have the policy file (.config) in the same location on the machine, Wise will automatically add it to the GAC.

0


source







All Articles