Im working on using the UmbracoHelper class to query some nodes using .Where(), On build I am getting :
Error 27 The type 'System.Web.Mvc.Controller' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Not really sure where to go from here, I have MVC 3 and MVC 4 installed. Not sure if it something I am doing wrong with the Where statement or if it really is a missing reference. Builds fine without the where.
var helper = new UmbracoHelper(UmbracoContext.Current);
var years = helper.TypedContent(1077).Children.Where(x => x.Id > 15);
foreach (var x in years)
{
response += x.Name;
}
I experienced the same issue (using .net 4.5). I have a repository class (separate project) that takes an int "id" and returns a list of names (as a simple example).
public IEnumerable<string> GetAllNewsItemNames(int id)
{
var helper = new UmbracoHelper(UmbracoContext.Current);
var newsContainer = helper.TypedContent(id);
return newsContainer.Children.Select(x => x.Name);
}
When I use the Linq Select() statement I get the error:
Error1The type 'System.Web.Mvc.Controller' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.D:\Dev\MyProject\MyProject.Repository\Umbraco\NewsRepository.cs2413MyProject.Repository
Error2The type 'System.Web.Http.ApiController' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.D:\Dev\MyProject\MyProject.Repository\Umbraco\NewsRepository.cs2413MyProject.Repository
If I only use foreach statement the error disappears:
public IEnumerable<string> GetAllNewsItemNames(int id) { var helper = new UmbracoHelper(UmbracoContext.Current); var newsContainer = helper.TypedContent(id); var names = new List<string>(); foreach (var newsItem in newsContainer.Children) { names.Add(newsItem.Name); } return names; }
I'd rather not have references to System.Web in my repository project in order to keep seperation of concerns. Any clues on this?
Missing MVC Reference?
Im working on using the UmbracoHelper class to query some nodes using .Where(), On build I am getting :
Not really sure where to go from here, I have MVC 3 and MVC 4 installed. Not sure if it something I am doing wrong with the Where statement or if it really is a missing reference. Builds fine without the where.
in your project references, do you have system.web.mvc listed? also, .net 4.5 is required.
I experienced the same issue (using .net 4.5). I have a repository class (separate project) that takes an int "id" and returns a list of names (as a simple example).
When I use the Linq Select() statement I get the error:
If I only use foreach statement the error disappears:
I'd rather not have references to System.Web in my repository project in order to keep seperation of concerns. Any clues on this?
is working on a reply...