0

I have a SharePoint project with a visual web part (WebPartA inherits from OtherWebPartC) - the web part references two DLL's, (ClassLibraryB and OtherWebPartC), and they are included in the package, set to be deployed to GAC.

When I deploy the project, the DLL's are successfully deployed to GAC, and the web part successfully shows up in the gallery in SharePoint.

However, when I try to add the visual web part (WebPartA) to a page, the page breaks - I enabled error display and stack trace - it says it can't find ClassLibraryB.dll. I used fuslogvw and procmon to determine that it was trying to load the DLL from typical locations (Virtual directory/bin, temporary asp.net folders), even though the DLL was not in these locations (but as I said, it was successfully deployed to GAC).

So I manually added ClassLibraryB.dll and OtherWebPart.dll to virtual directory/bin, and it worked successfully.

How do I get SharePoint to see the ClassLibraryB.dll and OtherWebPart.dll in the GAC? Or do I have to manually deploy the DLL to the site's Virtual Directory/bin?

Warren J Thompson
  • 408
  • 1
  • 7
  • 19

2 Answers2

0

Try to:

  • Change the WebPart/assemblies deployment target to "WebApplication" (instead of the GAC);

  • Retract the Solution and remove corresponding assemblies from the GAC;

  • Re-build and re-deploy the Solution together with the assemblies to the SharePoint Bin folder (the selected "WebApplication" deployment target).

Are all the necessary assemblies copied to the Bin folder? Does the Solution work in this case?

Mikhail
  • 9,186
  • 4
  • 33
  • 49
0

Just a heads up to all of you digging through these ancient questions... I stumbled upon this issue today, so i decided to leave a comment in order to claridy things. Most of the info can be taken from this great article by Waldek Mastykarz

  1. Using the Project you would like to package the Controls project including the SafeControls entries.
  2. Double click on the Package project item and the Package Designer will open.
  3. In the Package Designer you click the Advanced button. In the Advanced view you click the Add button and choose the Add Assembly from Project Output (the options are different in VS17 but they are similar)… menu option.
  4. From the Source Project dropdown list you choose your other Project.
  5. Then in the Safe Controls section, you click the Click here to add a new item button to add a new Safe Controls entry.
  6. Use the $SharePoint.Project.AssemblyFullName$ token so that you can specify that you want to include the fully qualified name of your assembly.
jimas13
  • 597
  • 5
  • 19