升级后ASP.NET Core 2.0 TagHelper错误

时间:2017-09-20 05:26:12

标签: asp.net asp.net-mvc asp.net-core azure-service-fabric asp.net-core-tag-helpers

在更新在Service Fabric中运行的ASP.NET MVC服务后,我收到了这个神秘的错误。经过大量的实际升级后,我设法让它在我的机器上的本地Service Fabric上运行。

我现在正尝试将其部署到实际的Service Fabric群集。我现在得到的错误如下:

Error RZ3501: Invalid tag helper bound property 'RouteValues' on tag helper 'Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper'. 
'Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute.DictionaryAttributePrefix' must be null unless property type implements 'IDictionary<string, TValue>'.
(0,0): Error RZ3501: Invalid tag helper bound property 'RouteValues' on tag helper 'Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper'.

请注意,在将ASP.NET MVC服务升级到版本2.0期间,我没有更改任何代码

这是我使用TagHelpers的示例:

@{
    IDictionary<string,string> routeData = SpecialMethodThatCalculatesRouteData();
}

<a asp-route="MyRoute" asp-all-route-data="@routeData" >

此代码在升级之前运行良好。

有人偶然发现了这个吗?

由于

编辑:这些是我在csproj文件中的引用:

<PackageReference Include="CompressedStaticFiles" Version="1.0.3" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
<PackageReference Include="Microsoft.ServiceFabric" Version="5.7.198" />
<PackageReference Include="Microsoft.ServiceFabric.AspNetCore.WebListener" Version="2.7.198" />
<PackageReference Include="Microsoft.ServiceFabric.Data" Version="2.7.198" />
<PackageReference Include="Microsoft.ServiceFabric.Services" Version="2.7.198" />
<PackageReference Include="Microsoft.ServiceFabric.Services.Remoting" Version="2.7.198" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.ServiceFabric.Native" Version="1.0.0-beta2" />
<PackageReference Include="NETStandard.Library.NETFramework" Version="2.0.0-preview2-25405-01" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="React.AspNet" Version="3.1.0" />
<PackageReference Include="Microsoft.Azure.DocumentDB" Version="1.17.0" />
<PackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="2.0.0" />

编辑:更多信息。我必须将这些任务添加到VSTS中的构建定义中以使项目编译

snip from VSTS build definition

3 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,将vsts构建为&#39; clean&#39;似乎解决了它。

答案 1 :(得分:0)

我有一个指向旧SDK(1.1)的global.json文件,删除该文件为我解决了这个问题。

答案 2 :(得分:0)

原来我们的构建代理有VS版本15.2,并且通过将构建代理升级到最新版本15.5,解决了这个问题。