1


So basically we have an strong-names (strongly signed) assembly x.dll which is used by one of our components, App.exe. The signing key of the assembly is in our repository and it the assembly is signed by means of writing

[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFileAttribute(@"..\..\xxx.snk")]
[assembly: AssemblyKeyName("")]

The assembly is supposed to be put in GAC by some installer which installs common packages, let's name it common.msi. But our component itself is installed by App.msi. When deployed together, everything works. But when changes are made to App.msi, ones that have ABSOLUTELY nothing to do with x.dll, and App.msi is redeployed, App.exe fails to find x.dll. Note that no changs are made to x.dll. When, however, common.msi is deployed as well, everything works. So I am guessing there must be an issue with build versions or something, or manifests which I know nothing about. Is there something obvious that I am doing wrong? Isn't it possible to just deploy the assembly separately and not touch it unless it is changed and not redeploy it every time a component that uses it is changed? Thanks.

Edit: It is a requirement (one I can't do anything about) that the ssembly be put in GAC

Armen Tsirunyan
  • 130,161
  • 59
  • 324
  • 434

1 Answers1

1

Why are you installing it into the GAC? Don't do that.

The title of your question "Assembly needs to be redeployed into GAC" is just wrong. Nothing you've written implies that the assembly needs to be in the GAC.


EDIT - some additional information.

If you want to examine dependencies, you can use Redgate's Reflector to examine an assembly, like your App.exe, to determine which other assemblies it depends on and requires. These dependencies will include version numbers.

I don't know of a tool from the commandline that will just emit assembly information. Maybe there is one. Lacking this, I wrote a tool to do it, like this:

    public static void Main(string[] args)
    {
        if ((((args == null) || (args.Length != 1)) || (args[0] == "-?")) || (args[0] == "-h"))
        {
            Usage();
        }
        else
        {
            try
            {
                Console.WriteLine(Assembly.LoadFrom(args[0]).FullName.ToString());
            }
            catch (Exception exception)
            {
                Console.WriteLine("Exception: {0}", exception.ToString());
                Usage();
            }
        }
    }

You could run this tool on App.exe as well as x.dll to determine the exact strong name, including version numbers, embedded into each assembly.

This might help give you some insight into why things aren't working as you expect.

Even if one version of x.dll is in the GAC, there's no need for an arbitrary app, like App.exe, to use that version of the DLL. The app can install in the local directory its own version of the dll.

Cheeso
  • 189,189
  • 101
  • 473
  • 713
  • That is a requirement, I can't change it. It is supposed that the assembly will be used by other components too. And your answer doesn't answer anything, unfortunately – Armen Tsirunyan Dec 28 '10 at 13:58
  • 1
    "Used by other components" is not a valid reason for installing into the GAC. You're doing it wrong! – Cheeso Dec 28 '10 at 14:00
  • A component doesn't have to be in the GAC to be used by other components. It just has to be in the same directory. – Femaref Dec 28 '10 at 14:00
  • @Cheeso, @Femaref: The requirement is that there not be different copies of the same assembly in folders of different components that use it. – Armen Tsirunyan Dec 28 '10 at 14:04
  • @Cheeso: This isn't my decision. It is a requirement I cannot do anything about – Armen Tsirunyan Dec 28 '10 at 14:05
  • @Armen. I'm not arguing with you. You don't need to defend the situation to me. I'm merely telling you the source of the problem. Fix that, and your problem will go away. – Cheeso Dec 28 '10 at 14:09
  • @Cheeso: Except that I can't fix it :) – Armen Tsirunyan Dec 28 '10 at 14:12