问题
I'm attempting to build the AutoOdataEF project with little success.
I'm getting the following exception:
Generated.OData.EF.API> Application startup exception: System.TypeLoadException: Could not load type 'Microsoft.AspNetCore.Mvc.Internal.IActionSelectorDecisionTreeProvider' from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Generated.OData.EF.API> at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType) Generated.OData.EF.API> at System.Signature..ctor(IRuntimeMethodInfo methodHandle, RuntimeType declaringType) Generated.OData.EF.API> at System.Reflection.RuntimeConstructorInfo.GetParametersNoCopy() Generated.OData.EF.API> at System.Reflection.RuntimeConstructorInfo.GetParameters() Generated.OData.EF.API> at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(Type serviceType, Type implementationType, ISet
1 callSiteChain) Generated.OData.EF.API> at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, ISet
1 callSiteChain) Generated.OData.EF.API> at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(Type serviceType, ISet1 callSiteChain) Generated.OData.EF.API> at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(Type serviceType, ISet
1 callSiteChain) Generated.OData.EF.API> at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, ISet1 callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound) Generated.OData.EF.API> at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(Type serviceType, Type implementationType, ISet
1 callSiteChain) Generated.OData.EF.API> at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, ISet1 callSiteChain) Generated.OData.EF.API> at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(Type serviceType, ISet
1 callSiteChain) Generated.OData.EF.API> at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(Type serviceType, ISet1 callSiteChain) Generated.OData.EF.API> at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType, ServiceProvider serviceProvider) Generated.OData.EF.API> at System.Collections.Concurrent.ConcurrentDictionaryExtensions.GetOrAdd[TKey,TValue,TArg](ConcurrentDictionary
2 dictionary, TKey key, Func3 valueFactory, TArg arg) Generated.OData.EF.API> at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType) Generated.OData.EF.API> at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) Generated.OData.EF.API> at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) Generated.OData.EF.API> at Microsoft.AspNetCore.Builder.MvcApplicationBuilderExtensions.UseMvc(IApplicationBuilder app, Action
1 configureRoutes) Generated.OData.EF.API> at Autogenerated.OData.Api.ODataEfApiGeneratorExtensions.UseODataEFGenerator(IApplicationBuilder app) Generated.OData.EF.API> at Generated.OData.EF.API.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) Generated.OData.EF.API> --- End of stack trace from previous location where exception was thrown --- Generated.OData.EF.API> at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() Generated.OData.EF.API> at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app) Generated.OData.EF.API> at Microsoft.ApplicationInsights.AspNetCore.ApplicationInsightsStartupFilter.<>c__DisplayClass0_0.b__0(IApplicationBuilder app) Generated.OData.EF.API> at Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<>c__DisplayClass3_0.b__0(IApplicationBuilder app) Generated.OData.EF.API> at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.b__0(IApplicationBuilder builder) Generated.OData.EF.API> at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication() Generated.OData.EF.API> crit: Microsoft.AspNetCore.Hosting.Internal.Web
I'm able to successfully go through these steps:
Clone the repo/Download a zip Open the OData-EF-APIGenerator solution Restore packages as necessary Build the solution Open the nuget package manager console, ensure the default project is set to EF.Example, and execute Update-Database, which will build and seed an initial SQL Express database. If you have SQL server instead of SQL express, just modify the connection strings in the EF.Example project
I fail on the last step:
Press F5, which should start the Generated.OData.EF.API project
What am doing wrong? How do I get this to build?
I've zipped the entire solution here, including packages.
来源:https://stackoverflow.com/questions/47117251/could-not-load-type-microsoft-aspnetcore-mvc-internal-iactionselectordecisiontr