Question


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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top