Kendo 升级到 Dotnet Core 1.0 后出错

Kendo error after upgrading to Dotnet Core 1.0

自升级到 Core Final 1.0 版本后,运行 MVC 站点出现以下错误: 在第 59 行 while 运行 services.AddKendo().

Line 57: services.AddMvc();  
Line 58: // Register UI for ASP.NET MVC helpers  
Line 59: services.AddKendo();  
Line 60:  
Line 61: // Addapplication services.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not load type 'Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions' from assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
at Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions.AddKendo(IServiceCollection services) at zepdata.com.Startup.ConfigureServices(IServiceCollection services) in PATH\Startup.cs:line 59 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at Microsoft.AspNetCore.Hosting.Internal.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection exportServices) at Microsoft.AspNetCore.Hosting.Internal.ConfigureServicesBuilder.<>c__DisplayClass4_0.b__0(IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services) at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices() at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

我升级了 VS 2015 Update 3 和 Dotnet Core 1.0。

将 services.AddKendo() 替换为其实现:

foreach (ServiceDescriptor service in Kendo.Mvc.KendoServices.GetServices())
    services.Add(service);
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();

它是必需的,因为最新版本的 Kendo 是为 aspnetcore-rc2 编译的。在 aspnet 1.0 中,某些 类 已重命名,因此 Kendo 无法找到它们。

https://github.com/aspnet/Announcements/issues/187

有一个 Kendo.Mvc 2016.2.630 内部版本似乎解决了这个问题。无法在他们的 nuget 站点上找到它,但是如果您登录到您的 telerik 帐户并转到您的产品下载,它应该列在内部版本下。

nupkg 在 \wrappers\aspnetmvc\Binaries\Mvc6

(但是网格还是有问题)

来自:https://github.com/telerik/kendo-ui-core/issues/1856