.net 刚刚通过NuGet更新了ImageResizer,can';t运行应用程序,因为它可以';我找不到BundleAttribute

.net 刚刚通过NuGet更新了ImageResizer,can';t运行应用程序,因为它可以';我找不到BundleAttribute,.net,azure,azure-web-app-service,imageresizer,.net,Azure,Azure Web App Service,Imageresizer,我只是尝试更新Azure存储,但这样做意味着我需要更新ImageResizer AzureReader并更新应用程序以使用.Net 4.5.2(Azure站点设置为.Net 4.6)。现在我所有的东西都是最新版本的;我已经清理并重建了应用程序。它可以在本地正常工作,但当我将其发布到Azure时,会出现以下错误。我无法加载诊断页面 Server Error in '/' Application. Could not load type 'ImageResizer.Util.BundleAttri

我只是尝试更新Azure存储,但这样做意味着我需要更新ImageResizer AzureReader并更新应用程序以使用.Net 4.5.2(Azure站点设置为.Net 4.6)。现在我所有的东西都是最新版本的;我已经清理并重建了应用程序。它可以在本地正常工作,但当我将其发布到Azure时,会出现以下错误。我无法加载诊断页面

Server Error in '/' Application.

Could not load type 'ImageResizer.Util.BundleAttribute' from assembly 'ImageResizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.TypeLoadException: Could not load type 'ImageResizer.Util.BundleAttribute' from assembly 'ImageResizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[TypeLoadException: Could not load type 'ImageResizer.Util.BundleAttribute' from assembly 'ImageResizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'.]
   System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
   System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +403
   System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +20
   System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +315
   System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +188
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +1184
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +146
   Owin.Loader.DefaultLoader.SearchForStartupAttribute(String friendlyName, IList`1 errors, Boolean& conflict) +180
   Owin.Loader.DefaultLoader.LoadImplementation(String startupName, IList`1 errorDetails) +184
   Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +138
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +38
   System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +242
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +108
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +642
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +353
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +447

[HttpException (0x80004005): Could not load type 'ImageResizer.Util.BundleAttribute' from assembly 'ImageResizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +684
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +121
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +771
我所有的ImageResizer插件都是4.0.4版本


有什么想法吗?

也许您的其他一些依赖项取决于ImageResizer 4.0.0.0

您可以使用程序集重定向作为解决方法



您正在混合v3 ImageResizer程序集和v4 ImageResizer程序集。删除所有ImageResizer*dll文件并重新安装一个版本。

您可以通过启用资源管理器中的
文件版本
列并查看
/bin
文件夹来验证错误版本控制的严重性

正如你所看到的,我有4.2的主DLL,但3.4的其他DLL


我尝试了这个,但我得到了相同的错误。除了ImageResizer插件之外,我想不出任何依赖它的东西。不过,我对C#development很陌生。因此,我正在查看解决方案,我看到,虽然我已将我的one assembly升级到ImageResizer 4.0.4,但该解决方案对ImageResizer 3.4.3具有NuGet依赖性。这可能是造成麻烦的原因吗?我真的希望我不必升级此解决方案中的每个组件。@所以ImageResizer 4.0.4不是NuGet参考?如果是这样,请删除此项并尝试更新由NuGet管理的项。这条路更干净。这基本上是正确的答案。事实证明,当我发布到Azure时,它保留了旧的dll文件。我不得不告诉VS,我希望它在发布之前删除部署槽中的所有文件。
      <dependentAssembly>
        <assemblyIdentity name="someAssembly"
          publicKeyToken="32ab4ba45e0a69a1"
          culture="en-us" />

        <bindingRedirect oldVersion="4.0.0.0" newVersion="4.0.4.0" />
      </dependentAssembly>