Reputation: 42504
Refer to
Good and full implementation of RSS feeds in ASP.net MVC
Check the answer of Trevor de Koekkoek.
I am getting this error CS1061: 'object' does not contain a definition for 'Items' and no extension method 'Items' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
Upvotes: 2
Views: 6758
Reputation: 3489
I had this problem. My fix was to search and replace all instances of "System.Web.Mvc, Version=2.0.0.0" with "System.Web.Mvc, Version=3.0.0.0"
There are multiple web.config files.
Upvotes: 4
Reputation: 146198
You may get this error if you have an MVC 2 project that at one point was an MVC 3 project.
This happened to me when I had to revert back to an MVC 2 version of an MVC 3 project. I had shelved my MVC 3.0 changes and brached the code in TFS (to make hotfixes to the MVC 2 version), but had leftover web.config files for my Razor Views. This was confusing the compiler.
3.0.0.0
to _web.config and it will stop looking. Then restart IIS.This should fix the problem.
If you still have the problem you may need to close all Visual Studio instances, stop IIS and delete temporary internet files. You can get the path to this directory by clicking the 'Show Detailed Compiler Output' link on the error page and searching for 'temporary'.
Upvotes: 0
Reputation: 164341
Do you get that error in the view ? In that case, you need to make your view strongly typed with SyndicationFeed as your model.
This means you should declare your View (.aspx) as something along the lines of:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<System.ServiceModel.Syndication.SyndicationFeed>" %>
This tells the view that the type of ViewData.Model is SyndicationFeed, so that you can access its properties and methods without casting.
Upvotes: -1