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?