标签: assemblybinding

.Net程序集绑定重定向与不同的公钥标记

如果公钥标记在旧版本上为空并且在较新版本上设置,是否可以在引用的程序集的不同版本之间执行程序集绑定重定向?

例如,我有两个组件......

System.Web.Mvc,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null

System.Web.Mvc,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35

以下程序集绑定重定向是否应该在Asp.Net web.config中工作...

System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Run Code Online (Sandbox Code Playgroud)

.net asp.net assemblybinding publickeytoken

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

如何启用程序集绑定日志记录?

我得到了,"无法加载文件或程序集'Bla'或其中一个依赖项.试图加载一个格式不正确的程序."

部分详细信息说:

"WRN:程序集绑定日志记录已关闭.要启用程序集绑定失败日志记录,请将注册表值[HKLM\Software\Microsoft\Fusion!EnableLog](DWORD)设置为1.注意:程序集绑定失败会导致一些性能损失要关闭此功能,请删除注册表值[HKLM\Software\Microsoft\Fusion!EnableLog]."

因此,考虑到这一点可能会让我深入了解为什么我收到上述错误(也许下一个YSOD会包含更明确的信息,说明它失败的原因),我导航到注册表中的那个位置,但是没有这样的键我能看到.它的作用是:

\Fusion 
    (Default)   value not set
    \GACChangeNotification
    \NativeImagesIndex
    \PublisherPolicy
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

registry regedit assemblybinding ysod

49
推荐指数
3
解决办法
15万
查看次数

在web.config> configuration> runtime> assemblyBinding中生成条目的含义/原因是什么?

我已经注意到我的web.config文件中的这一部分了一段时间,我现在试图弄清楚目的是什么:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
Run Code Online (Sandbox Code Playgroud)

所以,第一个条目似乎说:

System.Web.Helpers是具有公钥标记的依赖程序集的名称31bf3856ad364e35.将版本1.0.0.0到2.0.0.0重定向到版本2.0.0.0.

我最好的猜测是,它意味着在ASP.NET运行时上下文中执行的任何代码依赖于具有指定名称的程序集,该程序集也具有指定范围内的版本,就好像它是使用指定版本编译的一样执行指定的公钥.

这是否意味着如果我有一个依赖于类库的Web项目,并且该类库引用了具有aa bindingRedirect的旧版程序集,那么代码将执行就好像它是针对较新版本编译的一样?

c# asp.net web-config assemblybinding

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

装配绑定重定向和代码分析

我在Visual Studio 2010中的Mvc 3.0.0.0项目中使用DotNetOpenAuth(引用System.Web.Mvc版本1.0.0.0).

我正在使用程序集绑定重定向,如下所示: -

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>
Run Code Online (Sandbox Code Playgroud)

一切正常,除了代码分析,它给我以下错误: -

CA0001:读取模块X时遇到以下错误:无法解析程序集引用:System.Web.Mvc,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35.

CA0058:找不到引用的程序集"System.Web.Mvc,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35".此程序集是分析所必需的,并引用:X.

有没有办法让代码分析工具尊重程序集绑定重定向?

code-analysis visual-studio-2010 assemblybinding visual-studio

44
推荐指数
2
解决办法
9313
查看次数

程序集绑定日志查看器(fuslogvw)不记录任何绑定

程序集绑定日志查看器(fuslogvw)不记录我机器上安装的任何框架版本的绑定.

我尝试使用自定义日志位置,默认日志位置,默认类别和本机图像类别.

装配绑定日志查看器几个月前就已运行.我在64位计算机上运行C:\ Program Files(x86)\ Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64\FUSLOGVW.exe

.net assemblybinding fuslogvw

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

BindingRedirect到不同的程序集名称

您可以使用BindingRedirect将YourAssembly.dll 1.1.0.0重定向到1.2.0.0.

有没有人知道如果程序集名称不同,是否可以这样做.

例如

YourAssembly1.dll(v1.1)重定向到YourAssembly2.dll(v2.8)

.net assembly-resolution assemblybinding

23
推荐指数
2
解决办法
3884
查看次数

无法加载文件或程序集System.Web.Http,Version = 5.2.2.0

我刚刚将Asp.Net Web Api 2.2项目上传到生产服务器,我收到了标题中的错误.

在我的Web.config中我已经有了这个:

 <dependentAssembly>
    <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
  </dependentAssembly>
Run Code Online (Sandbox Code Playgroud)

该文件确实存在于bin中.什么会导致这个?
我的所有Asp.Net Web API文件都是最新的,并显示5.2.2作为版本.它在我的开发机器上工作正常.

asp.net web-config assemblybinding asp.net-web-api assembly-binding-redirect

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

无法加载文件或程序集“System.Threading.Tasks.Extensions,版本 = 4.2.0.0

我最近在尝试使用该库时安装了 CsvHelper ( https://joshclose.github.io/CsvHelper/ ),但出现以下错误:

无法加载文件或程序集“System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。(来自 HRESULT 的异常:0x80131040)

在我的 app.config 我有绑定重定向:

 <dependentAssembly>
            <assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
        </dependentAssembly>
Run Code Online (Sandbox Code Playgroud)

同样在我的项目中,我参考了

\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll

它的版本是 4.2.0.1 我不知道为什么它仍然试图加载库的 4.2.0.0。

我的项目正在运行 .net 4.7.2

c# assemblybinding assembly-binding-redirect csvhelper

15
推荐指数
3
解决办法
1万
查看次数

无法加载文件或程序集Autofac,Version = 3.3.0.0

将我的项目从Autofac 2.6.3.862升级到3.4.0.0后,出现以下错误.我甚至没有在解决方案的任何项目中添加对Autofac 3.3.0.0的任何引用.

=== Pre-bind state information ===
LOG: DisplayName = Autofac, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da
 (Fully-specified)
LOG: Appbase = file:///C:/Projects/Drive/temp/drive/Src/Web/
LOG: Initial PrivatePath = C:\Projects\Drive\temp\drive\Src\Web\bin
Calling assembly : Autofac.Configuration, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Projects\Drive\temp\drive\Src\Web\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Autofac, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da
LOG: Attempting download of new URL file:///c:/temp/root/79371609/925ee10/Autofac.DLL.
LOG: Attempting download of new URL …
Run Code Online (Sandbox Code Playgroud)

asp.net autofac assemblybinding

14
推荐指数
1
解决办法
1万
查看次数

FileLoadException在InitializeComponent或x:Class =

我在InitializeComponent-method 获得了文件加载器异常(第一次机会),或者调试器在x:Class多个WPF用户控件的xaml-root属性处断开.尽管异常减慢了导航的速度,但一切都运行良好.

这是异常消息:

无法加载文件或程序集'Company.Solution.UserInterface,Version = 0.1.5568.25577,Culture = neutral,PublicKeyToken = 45069ab0c15881ce'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)

这是Fusion日志:

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  D:\Development\Product\Main\src\Company.Product \bin\Debug\Product.vshost.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = Company.Product .UserInterface, Version=0.1.5568.25577, Culture=neutral, PublicKeyToken=45069ab0c15881ce
(Fully-specified)
LOG: Appbase = file:///D:/Development/Product/Main/src/Company.Product/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.     
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Development\Product \Main\src\Company.Product \bin\Debug\Product .vshost.exe.Config
LOG: Using …
Run Code Online (Sandbox Code Playgroud)

c# wpf assemblybinding probing

12
推荐指数
1
解决办法
466
查看次数