1

I am really baffled by this issue. I am very new to SP 2010 Development, so Your speak will have to be really dumbed down. But essentially I have this activation method I re-factored - Still re-factoring.

I created a class library as part of the solution and did the following:

namespace CustomerLibrary.CreateLists
{
    public class AddProjectList
    {

        public void ProjectList(SPFeatureReceiverProperties properties)
        {
            SPSite siteCollection = properties.Feature.Parent as SPSite;
            if (siteCollection != null)
            {
                SPWeb web = siteCollection.RootWeb;
                web.Lists.Add("Projects", "Projects That are currently being worked on.", SPListTemplateType.GenericList);
                web.Update();

                // Add the new list and the new content.
                SPList projectList = web.Lists["Projects"];
                projectList.Fields.Add("Name", SPFieldType.Text, false);
                projectList.Fields.Add("Description", SPFieldType.Text, false);
                projectList.Update();

                //Create the view? - Possibly remove me.
                System.Collections.Specialized.StringCollection stringCollection =
                    new System.Collections.Specialized.StringCollection();
                stringCollection.Add("Name");
                stringCollection.Add("Description");

                //Add the list.
                projectList.Views.Add("Project Summary", stringCollection, @"", 100,
                    true, true, Microsoft.SharePoint.SPViewCollection.SPViewType.Html, false);
                projectList.Update();
            }
        }
    }
}

From there, I went to my activation method and wrote the following:

    public override void FeatureActivated(SPFeatureReceiverProperties properties)
    {
        // Add a new project List
        AddProjectList apl = new AddProjectList();
        apl.ProjectList(properties);
    }

I then made sure that the Class Library was referenced in, and it is. Building it, the project, succeeds. Deploying it, is a whole other story:

Error 3 Error occurred in deployment step 'Activate Features': Could not load file or assembly 'CustomerLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=673a8d72e1a28a35' or one of its dependencies. The system cannot find the file specified.

That is the full error. There is no line, column or file. In case your wondering where it freaks out.

More people would say: Check your references. Done, its in the project. I am deploying this as a local SITE scoped as SITE.

I read some where that you have to make sure the DLL goes with the project when you hit deploy. Question is how do you do that?

| improve this question | | | | |
  • 1
    Open VS using run as administrator. – Nikhil J Apr 20 '14 at 14:48
3

I think you are referencing the external dll of class library in your sharepoint Project. I would request you to check if your wsp package of sharepoint solution contains the dll file in it.

How to open wsp file ? Locate the wsp file generated in the bin folder . Take a copy of it and rename it with extension (.cab) . Now open the File . Check whether you have the class library dll present in the package.

OR

Open the

Manifest xml

from the package.package in Visual studio. Check whether your custom library dll is being refered

  <Assemblies>
    <Assembly Location="CustomerLibrary.dll" DeploymentTarget="GlobalAssemblyCache" />
  </Assemblies>
| improve this answer | | | | |
  • 1
    But how do I add it to the .wsp file? – contactmatt Mar 13 '15 at 16:15
0

Are you bin deploying or gac deploying the wsp that this is in? Check both the GAC and the BIN folder for the dll that has your class in it. My guess is it isn't being deployed correctly.

Edit: Dispose your SPWebs and SPSites!

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.