Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'MvcSiteMapProvider.Web.Html.Models.SiteMapNodeModelList' does not contain a definition for 'Any' #479

Open
FranciscoG opened this issue Jun 4, 2018 · 2 comments

Comments

@FranciscoG
Copy link

FranciscoG commented Jun 4, 2018

I keep getting this error and I can't figure out how to fix it.

I'm on version 4.6.22
MacOS Sierra - Visual Studio Community 7.5.2
Mono version 5.10.1.57

System.Web.Compilation.CompilationException
CS1061: Type 'MvcSiteMapProvider.Web.Html.Models.SiteMapNodeModelList' does not contain a definition for 'Any' and no extension method 'Any' of type 'MvcSiteMapProvider.Web.Html.Models.SiteMapNodeModelList' could be found. Are you missing 'System.Linq' or 'MvcSiteMapProvider.Linq' or 'System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder' using directive?

Description: Error compiling a resource required to service this request. Review your source file and modify it to fix this error.

Details: CS1061: Type 'MvcSiteMapProvider.Web.Html.Models.SiteMapNodeModelList' does not contain a definition for 'Any' and no extension method 'Any' of type 'MvcSiteMapProvider.Web.Html.Models.SiteMapNodeModelList' could be found. Are you missing 'System.Linq' or 'MvcSiteMapProvider.Linq' or 'System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder' using directive?

Error origin: Compiler

Error source file: /my-project/Views/Shared/DisplayTemplates/SiteMapHelperModel.ascx

Exception stack trace:
at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath, System.CodeDom.Compiler.CompilerParameters options) [0x002fa] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs:853
at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs:731
at System.Web.Compilation.BuildManager.GenerateAssembly (System.Web.Compilation.AssemblyBuilder abuilder, System.Web.Compilation.BuildProviderGroup group, System.Web.VirtualPath vp, System.Boolean debug) [0x00202] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:826
at System.Web.Compilation.BuildManager.BuildInner (System.Web.VirtualPath vp, System.Boolean debug) [0x00106] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:451
Error source context:
Error lines: 7, 8

5: <ul class="siteMap">
6: <% foreach (var node in Model.Nodes) { %>
7:     <li><%=Html.DisplayFor(m => node)%>
8:     <% if (node.Children.Any()) { %>
9:         <%=Html.DisplayFor(m => node.Children)%>
@metzing
Copy link

metzing commented Jul 2, 2018

As the exception message suggests, you might be missing a using statement in your view?

@hurynnx
Copy link

hurynnx commented Jul 25, 2018

Just add >> using System.Linq;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants