1

I'm trying to use an ObjectDataSource in a SharePoint 2013 custom solution but I've the following errors...

Just start with the initial version of the ObjectDataSource:

<asp:ObjectDataSource ID="ods" runat="server" TypeName="BLProject.MyClass" />

MyNamespace.MyClass comes from another class library that interacts with the database using EntityFramework.

So with this ObjectDataSource I get the error

The type specified in the TypeName property of ObjectDataSource 'ods' could not be found.

Using Google I found this link so my control has become:

<asp:ObjectDataSource ID="ods" runat="server" TypeName="BLProject.MyClass, $SharePoint.Project.AssemblyFullName$" />

But nothing changed, so after another search with Google I added this

        <add assembly="BLProject.MyClass, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

And I get this error:

Could not load file or assembly 'BLProject.MyClass, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

What I'm doing wrong?

Thank you

1
0

When you build your class project it will generate a dll in bin folder. You need to get the dll and add it to package in your Sharepoint project then deploy or build

3
  • Hello, I followed your suggestion adding the BL dll as both mode (Assembly from Project Output and Existing Assembly) nothing changed. I also added in the same way the EntityFramework.dll.
    – chenny
    Jun 10 '15 at 7:51
  • Hello, I got the solution and your suggestion was part of it. Thank you!
    – chenny
    Jun 10 '15 at 20:10
  • i am glad it helped you can mark it up or as your answer Jun 11 '15 at 1:49
0

I found a solution in two steps.

The first step is follow the Akshay suggestion ad after I added the assembly reference in the web.config.

Something like

<add assembly="BLL, Version=1.0.0.0, Culture=neutral, PublicTokenKey=123456" />

You can obtain the PublicTokenKey using the Visual Studio Developer Command Prompt and the command sn -T MyAssembly.dll from the dll folder.

Thank you again

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.