Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / May 2005

Tip: Looking for answers? Try searching our database.

Problem with Publisher Policy File (Can't install)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cpnet - 03 May 2005 01:39 GMT
I'm having problems with a publisher policy file I'm trying to put in the
GAC.  I did it with a previous verison, but now I can't seem to get it to
work.  The error I get is, "Failure adding assembly to the cache: One of
more modules specified in the manifest not found.".  I am using gacutil to
try to install the policy file into the GAC.

The following works fine when I put it in the app config file:

<configuration>
  <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="MyCompany.MyAssembly.NET"
                          publicKeyToken="db4fd244c1bc0b6e"
                          culture="neutral" />
        <!-- Redirecting to version 0.1.0.1 of the assembly. -->
        <bindingRedirect oldVersion="0.1.0.0"
                         newVersion="0.1.0.1"/>
      </dependentAssembly>
     </assemblyBinding>
  </runtime>
</configuration>

However, when I put the above XML into policy.config and try to put it into,
"policy.0.1.MyCompany.MyAssembly.NET.dll" I can't install it into the gac.
Here's the command I'm using to create
"policy.0.1.MyCompany.MyAssembly.NET.dll":

"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\al.exe"
/link:"$(SolutionDir)MyProj\policy.config"
/out:"$(SolutionDir)MyProj\output\policy.0.1.MyCompany.MyAssembly.NET.dll"
/keyfile:"$(SolutionDir)StrongName\MyCompany.snk"

The strong name key file is the same one used to sign all of my assemblies.
I've tried with both the old an new versions of
"MyCompany.MyAssembly.NET.dll" in the GAC already (they install fine).  I've
double checked the culture, versions, and the public key token.

Help!
cpnet - 03 May 2005 15:01 GMT
Looking at my "policy.0.1.MyCompany.MyAssembly.NET.dll" file, in ILDASM, the
only assembly it seems to reference is mscorlib.

When I look at the GAC viewer, I actually see there's 2 copies of mscorlib -
but they're exactly the SAME!!!  (Same version, culture, name, public
key)?!?  This shouldn't be happening should it?  I also see that I seem to
have 4 identical copies of MS.VSDesigner in the GAC.  This is on a fully
patched WinXP Pro sp2 machine.

I tried installing on my SBS 2k3 server, and I get the same error trying to
put "policy.0.1.MyCompany.MyAssembly.NET.dll" in the GAC.  The GAC on the
SBS box doesn't seem to have duplicate assemblies, so maybe that's not the
problem.

But, I may have 2 separate problems:  I can't install
"policy.0.1.MyCompany.MyAssembly.NET.dll" into the GAC, and the GAC on my XP
machine seems to have multiple copies of the same assembly.
Brock Allen - 03 May 2005 16:17 GMT
> When I look at the GAC viewer, I actually see there's 2 copies of
> mscorlib - but they're exactly the SAME!!!  (Same version, culture,
> name, public key)?!?  This shouldn't be happening should it?  I also
> see that I seem to have 4 identical copies of MS.VSDesigner in the
> GAC.  This is on a fully patched WinXP Pro sp2 machine.

Some of those are ngen images, and even with those you can have a debug and
a release version. Also, how many versions of the CLR do you have installed?
That could account for the multiple copies.

-Brock
DevelopMentor
http://staff.develop.com/ballen
cpnet - 03 May 2005 19:51 GMT
I guess I need to brush up on my knowledge of assemblies and the GAC.  I
thought that at least one of the properties I can see in the GAC viewer
(name, version, culture, public key etc). had to differ for multiple
versions of the 'same' assembly to be in the GAC.  But I guess other things
can differ that aren't immediately visible.
cpnet - 03 May 2005 19:20 GMT
This is sort of working now, but not in a satisfactory way.  I found out the
problem was that I didn't have "policy.config" in the same folder as where,
"policy.0.1.MyCompany.MyAssembly.NET.dll", was located when I tried to add,
"policy.0.1.MyCompany.MyAssembly.NET.dll" to the GAC.  As soon as
"policy.config" was in the right place, things seemed to work.

To try and avoid this problem, I tried to build
"policy.0.1.MyCompany.MyAssembly.NET.dll" with al.exe, using the "embed"
option instead of "link".  This seemed to go ok, and I was able to install
"policy.0.1.MyCompany.MyAssembly.NET.dll" into the GAC without having to
worry about the location of "policy.config".  So far, so good.  However, I
found that my publisher policy file wouldn't function when it's created with
"embed" rather than "link".

So, now I'm confused.  How would I distribute this?  I don't know where
policy.config will be on the client machine, and putting
"policy.0.1.MyCompany.MyAssembly.NET.dll" in the GAC seems to lose most of
it's benifit if it has to know about some path to policy.config on the
client's machine.  It doesn't seem safe to have an install script
dynamically create "policy.0.1.MyCompany.MyAssembly.NET.dll", since that
would require also shipping the private part of my key file to be able to
give a strong name to "policy.0.1.MyCompany.MyAssembly.NET.dll".  Maybe I'm
missing something here, but if I can't embed policy.config into
"policy.0.1.MyCompany.MyAssembly.NET.dll", how can I be sure that
policy.config will be found?
Brock Allen - 03 May 2005 19:22 GMT
I suspect when you install it into the GAC the .config file is also copied
there.

-Brock
DevelopMentor
http://staff.develop.com/ballen

> This is sort of working now, but not in a satisfactory way.  I found
> out the problem was that I didn't have "policy.config" in the same
[quoted text clipped - 23 lines]
> "policy.0.1.MyCompany.MyAssembly.NET.dll", how can I be sure that
> policy.config will be found?
cpnet - 03 May 2005 19:48 GMT
I think you're right.  I need policy.config when adding
"policy.0.1.MyCompany.MyAssembly.NET.dll" into the GAC, but once
"policy.0.1.MyCompany.MyAssembly.NET.dll" is in the GAC, I can erase
policy.config, and everything works fine.

I didn't think something like policy.config could be added to the GAC.  I
guess you just can't _directly_ add something like this to the GAC.

Thanks for your help Brock!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.