Microsoft.VisualStudio.Services.WebApi Error

0

I have an ASP.net MVC Web application running on .Net Framework v4.6.1 which is referring library project, which, in turn is referring to the Nuget package 'Microsoft.TeamFoundationServer.ExtendedClient' v14.89.0. This package depends on the Nuget package 'Microsoft.VisualStudio.Services.Client' v14.89.0, among others.

Today, I upgraded the 'TeamFoundationServer.ExtendedClient' to v15.112.1 (latest stable) which in turn updated 'VisualStudio.Services.Client' to the same version as well.

Post the upgrade, I encounter the following error on running the web application:

System.TypeLoadException occurred
  HResult=0x80131522
  Message=Could not load type 'Microsoft.VisualStudio.Services.Extension.InstalledExtension' from assembly 'Microsoft.VisualStudio.Services.WebApi, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
  Source=mscorlib
  StackTrace:
   at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeMethodInfo.get_ReturnType()
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.GetReturnType(MethodInfo methodInfo)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.InitializeProperties(MethodInfo methodInfo)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor..ctor(HttpControllerDescriptor controllerDescriptor, MethodInfo methodInfo)
   at System.Web.Http.Controllers.ApiControllerActionSelector.ActionSelectorCacheItem..ctor(HttpControllerDescriptor controllerDescriptor)
   at System.Web.Http.Controllers.ApiControllerActionSelector.GetInternalSelector(HttpControllerDescriptor controllerDescriptor)
   at System.Web.Http.Controllers.ApiControllerActionSelector.GetActionMapping(HttpControllerDescriptor controllerDescriptor)
   at System.Web.Http.Routing.AttributeRoutingMapper.AddRouteEntries(SubRouteCollection collector, HttpConfiguration configuration, IInlineConstraintResolver constraintResolver, IDirectRouteProvider directRouteProvider)
   at System.Web.Http.Routing.AttributeRoutingMapper.<>c__DisplayClass2.<>c__DisplayClass4.<MapAttributeRoutes>b__1()
   at System.Web.Http.Routing.RouteCollectionRoute.EnsureInitialized(Func`1 initializer)
   at System.Web.Http.Routing.AttributeRoutingMapper.<>c__DisplayClass2.<MapAttributeRoutes>b__0(HttpConfiguration config)
   at System.Web.Http.HttpConfiguration.EnsureInitialized()
   at System.Web.Http.GlobalConfiguration.Configure(Action`1 configurationCallback)
   at ACMEApps.Core.Web.MvcApplication.Application_Start() in C:\ACMEApps\ACMEApps.Core.Web\Global.asax.cs:line 18

In code, the error occurs after the execution of line 'GlobalConfiguration.Configure(WebApiConfig.Register)' but before the line 'FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters)' in the following snippet:

protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();
    GlobalConfiguration.Configure(WebApiConfig.Register);
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);
}

The error is not occurring in the WebApiConfig.Register method but after the control is returned to Application_Start() method. Upon inspection of the assembly, I noticed that the type 'Microsoft.VisualStudio.Services.Extension.InstalledExtension' is indeed missing from the updated version.

I attempted to skip copying of the file to the web application's bin folder but that results in FileNotFound exception for 'Microsoft.VisualStudio.Services.WebApi.dll'.

Any suggestions on how to resolve this error if I need to continue using the updated Nuget packages?

c#
nuget
asked on Stack Overflow Sep 8, 2017 by Vishal

1 Answer

-1

Delete both bin and obj files. then do full rebuild and see


User contributions licensed under CC BY-SA 3.0