首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法从Unity2.0迁移到Unity2.1.505.0

无法从Unity2.0迁移到Unity2.1.505.0
EN

Stack Overflow用户
提问于 2013-09-15 08:46:15
回答 2查看 5K关注 0票数 1

我有一个使用Unity2.0编写的应用程序,我正在尝试迁移到2.1.505.0版本。我将项目中的引用更改为指向与较新版本对应的DLL。当我建立解决方案的时候,一切都很顺利。但是,当我尝试运行应用程序时,它给了我一个FileNotfoundException:

代码语言:javascript
复制
Stack Trace: 

[FileLoadException: Could not load file or assembly 'Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   InsightsService.WebApi.WebApiApplication.Application_Start() in E:\tfs\DisplayApps\Services\InsightsBps\Dev\source\InsightsService.WebApi\Global.asax.cs:30

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12863325
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12880068
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12721257

我检查了web.config,找不到任何重写。我甚至清理了解决方案并重建了它,但问题依然存在。这里有什么问题吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-09-15 12:49:48

您可以使用AssemblyBinding来确保在请求旧版本时使用统一的新版本。在下面的配置文件中,它应该可以工作。

代码语言:javascript
复制
<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.Practices.Unity"
                        publicKeyToken="31bf3856ad364e35"
                       />
      <!-- Assembly versions can be redirected in application, publisher policy, or machine configuration files. -->
      <bindingRedirect oldVersion="2.0.414.0"
                       newVersion="2.1.505.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.Practices.Unity.Interception"
                        publicKeyToken="31bf3856ad364e35"
                       />
      <!-- Assembly versions can be redirected in application, publisher policy, or machine configuration files. -->
      <bindingRedirect oldVersion="2.0.414.0"
                       newVersion="2.1.505.0"/>
    </dependentAssembly>
  </assemblyBinding>
</runtime>

当我更新到新的统一版本时,我也遇到了同样的问题,但是我使用的企业库请求旧版本,因为企业库是针对2.0.414.0版本构建的。

票数 4
EN

Stack Overflow用户

发布于 2013-09-15 09:07:40

项目中的某些内容仍在引用旧的DLL。

您是否试过打开fuslogvw (有关说明请参阅http://msdn.microsoft.com/en-us/library/e74a18c4.aspx )并查看它所做的日志记录?通常情况下,引用问题很快就会出现。

如果发现引用是无法修复的(例如,另一个您不拥有的DLL ),则可以查看如何设置绑定重定向。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18810566

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档