+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / How To Reference External Assemblies

How To Reference External Assemblies

3 posts, 1 answered
  1. Kevin
    Kevin avatar
    9 posts
    Registered:
    27 Oct 2014
    02 Jun 2015
    Link to this post
    I would like to know how to include and reference external dll's.   I would like to add our data layer as a DLL to a Sitefinity project and reference it in controllers for custom MVC widgets.

    I have done the following:
    1. Copied Entities.dll from another project and pasted it into the Sitefinity BIN folder.  
    2. Right Clicked the References folder and selected "Add Reference"
    3. Browsed to the Entities.dll in the Sitefinity bin folder then added it.
    4. Adding using Entities; to the controller

    This gives me the following error on build:
    "The type or namespace name 'Entities' could not be found (are you missing a using directive or assembly reference?)"

    Without the using directive, the project builds fine.

    There is no yellow icon on the Entities reference and "UpdateReferences.0.log" file in shows that I found 1 new reference.

    I have also tried:
    1.  Importing the Entities project into the Sitefinitiy solution and adding a reference.
    2. Adding the reference by selecting the Entities.dll from the source project bin folder and verified that it "automatically" copied it to the sitefinity bin folder

    The error is the same regardless.

    Thank you for your guidance,
    Kevin Howell
    Answered
  2. Victor
    Victor avatar
    94 posts
    Registered:
    15 Jun 2011
    02 Jun 2015 in reply to Kevin
    Link to this post
    Make sure that the .NET versions match and that you are not building the DLL (Entities) for "Client Profile".
  3. Kevin
    Kevin avatar
    9 posts
    Registered:
    27 Oct 2014
    02 Jun 2015 in reply to Victor
    Link to this post

    Thank you Victor!  It was that the Entities was 4.5 and Sitefinity was 4.0.  I changed the framework of the Sitefinity project- with threw 3 duplicate reference errors that when cleared allowed me to successfully build the project.

    Yours,

    Kevin Howell

3 posts, 1 answered