A few weeks ago the Sitefinity 4.0 BETA SDK was released. This SDK includes tools, examples and documentation designed to help developers create add-on’s or customizations for Sitefinity. As time allows, I’ve been experimenting with these new developer features.
However, in the midst of this exploration I also discovered that that the Web Application projects created by Sitefinity’s Project Manager are missing assembly references required to use the Fluent API and other Sitefinity 4.0 developer features.
This means code samples from the Sitefinity 4.0 BETA documentation fail to compile.
This blog post describes how to add these missing assembly references:
Adding the missing assemblies
1. Open Sitefinity’s Project Manager
2. Select the project
2. Click the Edit in Visual Studio button
3. In the Solution Explorer, right-click References and click Add Reference
4. Click the Browse tab
5. Navigate to the project’s ~/bin folder
6. Use Control + A to select all the files in this folder
Realistically, you probably don’t need all of these assembly references. In most cases, you probably only need a reference to Telerik.Sitefinity.Model. However, adding all assemblies will ensure you have everything you could possibly need.
7. Click the OK button
Visual Studio should now be able to resolve the namespaces:
[ This code sample can be found in the Sitefinity documentation ]
Reference to component already exists
If you received this error:
…then it probably means you have Telerik’s RadControls installed on your computer. Visual Studio has added a reference to these installed assemblies. If the installed version of RadControls matches the version used by Sitefinity, then everything will be fine. However, if there is a version mismatch then the Sitefinity project will crash.
I wrote a detailed blog post describing this issue and how to fix it.
To fix this, the existing references need removed and the new ~/bin assembly references need added.
Errors related to this blog post
These are common errors related to this blog post. I’m posting these errors for SEO & discoverability purposes:
A reference to ‘C:\Users\sumner\Desktop\Demo\Projects\Demo\bin\Telerik.WebDesign.dll’ could not be added. A reference to the component ‘Telerik.Web.Design’ already exists in the project.
A reference to ‘C:\Users\sumner\Desktop\Demo\Projects\Demo\bin\Telerik.Web.UI.dll’ could not be added. A reference to the component ‘Telerik.Web.Design’ already exists in the project.
The type or namespace name 'GenericContent' does not exist in the namespace 'Telerik.Sitefinity' (are you missing an assembly reference?).
Telerik.Sitefinity.Fluent.Content.BlogFacade.ContentFacade<BlogFacade, Telerik.Sitefinity.Blogs.Model.Blog.BlogFacade>.Do(Action<Telerik.Sitefinity.Blogs.Model.Blog> setAction)
Performs an arbitrary action on the content object.
Type types argument for method Telerik.Sitefinity.Fluent.Content.BlogFacade.ContentFacade<BlogFacade, Telerik.Sitefinity.Blogs.Model.Blog.BlogFacade>.Do(Action<Telerik.Sitefinity.Blogs.Model.Blog> setAction) cannot be inferred from usage. Try specifying the type arguments explicitly.