微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

以下方法或属性之间的调用不明确:'Umbraco.Web.UmbracoHelper.Media(params int[])'和'Umbraco.Web.UmbracoHelper

如何解决以下方法或属性之间的调用不明确:'Umbraco.Web.UmbracoHelper.Media(params int[])'和'Umbraco.Web.UmbracoHelper

我最近尝试将我的网站从 U7.15.6 升级到 U8。我刚刚使用 FileZilla 将 /bin /umbraco /config 复制到我当前的网站

当我尝试回滚到 U7.15.6 时出现以下错误

以下方法属性间的调用不明确:'Umbraco.Web.UmbracoHelper.Media(params int[])'和'Umbraco.Web.UmbracoHelper.Media(params string[])'说明:未处理的异常在执行当前 Web 请求期间发生。请查看堆栈跟踪以了解有关错误及其在代码中的来源的更多信息。

异常详细信息:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException:调用在以下方法属性之间不明确:'Umbraco.Web.UmbracoHelper.Media(params int[])'和'Umbraco.Web.UmbracoHelper.Media(参数字符串[])'

错误

Line 20:    var section_node = Umbraco.Content(1xxx);    
Line 21:    var Section_pagesToList = @Section_node.Children.Where("Visible");
Line 22:    Section_pagesToList = Section_node.DescendantsOrSelf().Where("NodeTypeAlias == @0","NewsPage");

所以我做了什么,我将第 21 行更改如下:

string[] Section_pagesToList = @Section_node.Children.Where("Visible");

但是现在我在页面的其他部分遇到另一个错误 - 我在其中显示了该部分的特征图像:

 Line 81:               <div class="col-xl-6 col-lg-6 col-md-4 MainNewsBox">
Line 82:                    <figure>
Line 83:                        @if (Section_pagesToList.Last().HasValue("articleImg"))     

第 83 行的错误是:

Compiler Error Message: CS1929: 'string' does not contain a deFinition for 'HasValue' and the best extension method overload 'PublishedContentExtensions.HasValue(IPublishedContent,string)' requires a receiver of type 'IPublishedContent'

我该如何解决并恢复我的网站?

谢谢。

解决方法

如果您无法通过 VCS 回滚,我认为您需要重新安装 v7.15.6 才能恢复正确的 DLL。也许借此机会开始使用 Nuget。关于 v7 -> v8 没有直接的升级方法。在 https://our.umbraco.com 上,您可以找到有关如何迁移 (!) 到 v8 的更多信息。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。