ASP.NET Core System.TypeLoadException DependencyInjection.Extensions.ServiceCollectionExtensions error -


i new asp.net core. while creating simple mvc project got following error.

system.typeloadexception not load type 'microsoft.extensions.dependencyinjection.extensions.servicecollectionextensions' assembly 'microsoft.extensions.dependencyinjection.abstractions, version=1.0.0.0, culture=neutral, publickeytoken=adb9793829ddae60'. @ microsoft.extensions.dependencyinjection.optionsservicecollectionextensions.addoptions(iservicecollection services) @ microsoft.extensions.dependencyinjection.mvccoreservicecollectionextensions.addmvccore(iservicecollection services, action setupaction) @ microsoft.extensions.dependencyinjection.mvcservicecollectionextensions.addmvc(iservicecollection services, action setupaction) @ poc.startup.configureservices(iservicecollection services)

system.reflection.targetinvocationexception exception has been thrown target of invocation. @ system.runtimemethodhandle.invokemethod(object target, object[] arguments, signature sig, bool constructor) @ system.reflection.runtimemethodinfo.unsafeinvokeinternal(object obj, object[] parameters, object[] arguments) @ system.reflection.runtimemethodinfo.invoke(object obj, bindingflags invokeattr, binder binder, object[] parameters, cultureinfo culture) @ microsoft.aspnetcore.hosting.internal.configureservicesbuilder.invoke(object instance, iservicecollection exportservices) @ microsoft.aspnetcore.hosting.internal.webhost.ensureapplicationservices() @ microsoft.aspnetcore.hosting.internal.webhost.buildapplication()

following project.json file

{   "dependencies": {     "microsoft.netcore.app": {       "version": "1.0.0",       "type": "platform"     },     "microsoft.aspnetcore.diagnostics": "1.0.0",     "microsoft.aspnetcore.server.iisintegration": "1.0.0",     "microsoft.aspnetcore.server.kestrel": "1.0.0",     "microsoft.extensions.logging.console": "1.0.0",     "microsoft.aspnet.iisplatformhandler": "1.0.0-rc1-final",     "microsoft.aspnet.server.kestrel":"1.0.0-rc1-final",     "microsoft.aspnet.mvc": "6.0.0-rc1-final",     "microsoft.aspnet.mvc.core": "6.0.0-rc1-final"   },    "tools": {     "microsoft.aspnetcore.server.iisintegration.tools": "1.0.0-preview2-final"   },    "frameworks": {     "netcoreapp1.0": {       "imports": [         "dotnet5.6",         "portable-net45+win8"       ]     }   },    "buildoptions": {     "emitentrypoint": true,     "preservecompilationcontext": true   },    "runtimeoptions": {     "configproperties": {       "system.gc.server": true     }   },    "publishoptions": {     "include": [       "wwwroot",       "web.config"     ]   },    "scripts": {     "postpublish": [ "dotnet publish-iis --publish-folder %publish:outputpath% --framework %publish:fulltargetframework%" ]   } } 

following startup.cs file

using system; using system.collections.generic; using system.linq; using system.threading.tasks; using microsoft.aspnet.builder; using microsoft.aspnetcore.hosting; using microsoft.aspnetcore.http; using microsoft.extensions.logging; using microsoft.extensions.dependencyinjection;  namespace poc {     public class startup     {         // method gets called runtime. use method add services container.         // more information on how configure application, visit http://go.microsoft.com/fwlink/?linkid=398940         public void configureservices(iservicecollection services)         {             services.addmvc();         }          // method gets called runtime. use method configure http request pipeline.         public void configure(iapplicationbuilder app)         {             app.usemvc( m=>              m.maproute(                 name:"default",                 template:"{controller}/{action}/{id?}",                 defaults:new { controller="home", action="index"}                 ));         }     } } 

i error @ service.addmvc() line in startup.cs file please suggest solution this.

have tried using dependency mvc in project.json:

"microsoft.aspnetcore.mvc": "1.0.0" 

instead of these?

"microsoft.aspnet.mvc": "6.0.0-rc1-final", "microsoft.aspnet.mvc.core": "6.0.0-rc1-final" 

it's possible using aspnetcore aspnet mvc dependencies leads conflicts.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -