Reference.svcmap: 无法加载文件或程序集 Microsoft.Practices.ServiceLocation,版本=1.0.0.0

Reference.svcmap: Could not load file or assembly Microsoft.Practices.ServiceLocation, Version=1.0.0.0

我有一个简单的网络表单网站项目。该项目使用通过 NuGet 添加的 Microsoft Application Block Unity 3.5(DI 容器)。

现在我正在使用这个第 3 方网络服务。添加服务参考并构建后,我得到了这个:

Error 19 Reference.svcmap: Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.0.0.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) App_WebReferences/MyExternalService/

所以我安装了 Microsoft.Practices.ServiceLocation,但它仍然一直抱怨那个程序集。

我尝试将此添加到我的 web.config 但仍然无效。

 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.ServiceLocation" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>

卸载Unity包后一切正常。没有错误,我可以使用服务代理

尝试了 Clean Build 等,但没有任何效果。

有什么想法吗?

我安装了错误的包以获取对 Microsoft.Practices.ServiceLocation

的引用

包裹错误:

正确的包裹是: