5

I have a solution in Visual Studio 2010 that is made up of 3 projects.

I have one project for my SharePoint 2010 custom timer job, one project (Project A) that is used by my custom timer job, and another project (Project B) that is used by Project A.

The problem is that when I package my project the WSP only installs the Custom Timer Job to the GAC. Is there some way to have all dependant DLLs installed as well?

Abe Miessler
  • 82,532
  • 99
  • 305
  • 486

1 Answers1

11

You have to add those DLLs (project references) manually into the WSP project's manifest. There's a UI in Visual Studio to assist you with this, no need to modify the XML directly.

Steps:

  1. In Solution Explorer within your WSP project locate the Package folder.
  2. Double-click on Package.package file to open the package designer.
  3. In the bottom of the screen click on 'Advanced'; a screen showing 'Additional Assemblies' will open.
  4. Click on 'Add' and select 'Add assembly from Project Output'.
  5. Choose the assembly and deployment mode (GAC or WebApplication = bin folder).

In this dialog you can also register the associated safe controls and resources. Also, via 'Add Existing Assembly' you can add assemblies available in binary form only (i.e. not available as VS projects in source code).

Ondrej Tucny
  • 27,626
  • 6
  • 70
  • 90
  • Ok, I tried doing that and got this error when I tried to Add the Solution through management console: `This solution contains one or more assemblies targeted for the global assembly cache. You should use a strong name for any assembly that will be in the global assembly cache.` – Abe Miessler Mar 29 '11 at 20:38
  • 1
    You have to sign all assemblies that go to GAC. Delay-sign in VS is OK. – Ondrej Tucny Mar 29 '11 at 20:44
  • +1, that fixed it. I got it to install Add/Install alright but when the job tries to run i get this error: Could not load file or assembly 'ProjectA, Version.........' or one of its dependencies. The system cannot find the file specified. Any idea why it's skipping the last one? – Abe Miessler Mar 29 '11 at 21:34
  • I just looked a little more closely and it looks like while the assembly is in there it has the wrong PublicKeyToken. Do you know how this could happen? – Abe Miessler Mar 29 '11 at 21:36
  • The PublickKeyToken depends on the key you've used for signing the assembly. Thus in case you changed it while leaving an older copy in the GAC, you may run into a conflict. Try `gacutil.exe /u assembly.dll` to unistall all such assemblies, restart VS, clean, rebuild and deploy your solution again. – Ondrej Tucny Mar 29 '11 at 22:41
  • Don't forget to sign the targeted assembly with a .snk file! – Muhammedh Feb 24 '14 at 13:11