相关疑难解决方法(0)

程序集绑定重定向不起作用

我正在尝试使用以下app.config设置程序集绑定重定向:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.AnalysisServices"
                          PublicKeyToken="89845dcd8080cc91" />
        <bindingRedirect oldVersion="10.0.0.0"
                         newVersion="9.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
Run Code Online (Sandbox Code Playgroud)

我在GAC中使用版本9.0.242.0的计算机上运行该程序,并使用指定的公钥令牌.CLR似乎甚至没有尝试重定向绑定以使用该版本.

这是我在fuslogvw.exe中得到的:

LOG: This bind starts in default load context. LOG: Using application configuration file: \Debug\AssemblyRedirectPOC.exe.Config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config. LOG: Post-policy reference: Microsoft.AnalysisServices, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 LOG: GAC Lookup was unsuccessful. LOG: Attempting download of new URL /Debug/Microsoft.AnalysisServices.DLL. LOG: Attempting download of new URL /Debug/Microsoft.AnalysisServices/Microsoft.AnalysisServices.DLL. LOG: Attempting download of new URL /Debug/Microsoft.AnalysisServices.EXE. LOG: Attempting download of new URL …

.net c# binding assemblies reference

30
推荐指数
7
解决办法
5万
查看次数

无法解决程序集引用 - dependentAssembly问题?

我的构建服务器(TFS/Visual Studio Online)上发生以下错误:

CA0055 : Could not load C:\a\Binaries\Api.dll. The following error was encountered while reading module 'System.Net.Http.Formatting': Assembly reference cannot be resolved: Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed.
CA0058 : The referenced assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' could not be found. This assembly is required for analysis and was referenced by: C:\a\Binaries\Api.dll, C:\a\Sources\MyLocation\packages\Microsoft.AspNet.WebApi.Client.5.1.1\lib\net45\System.Net.Http.Formatting.dll.
Run Code Online (Sandbox Code Playgroud)

这是web.config dependentAssembly我的Api.dll项目中此程序集的条目:

<dependentAssembly>
  <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
  <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)

已安装的Json.NET NuGet包的实际版本是6.0.1:

在此输入图像描述

在查看项目引用时,我将Newtonsoft.Json作为6.0.0.0:

在此输入图像描述

System.Net.Http.Formatting引用的版本是5.1.0.0.

在构建定义中启用了NuGet还原,并且我的本地副本上没有这些错误,仅在TFS中.

有人能够发现可能出现的问题吗?

我想这可能是由于dependentAssembly进入,但我不能让它工作.

.net c# tfs web-config nuget

19
推荐指数
2
解决办法
2万
查看次数

标签 统计

.net ×2

c# ×2

assemblies ×1

binding ×1

nuget ×1

reference ×1

tfs ×1

web-config ×1