How To Reference External Assemblies

Posted by Community Admin on 04-Aug-2018 18:00

How To Reference External Assemblies

All Replies

Posted by Community Admin on 02-Jun-2015 00:00

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

Posted by Community Admin on 02-Jun-2015 00:00

Make sure that the .NET versions match and that you are not building the DLL (Entities) for "Client Profile".

Posted by Community Admin on 02-Jun-2015 00:00

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

This thread is closed