简体   繁体   English

System.Windows.Interactivity.dll加载两次

[英]System.Windows.Interactivity.dll loaded twice

I'm using in my application System.Windows.Interactivity.dll. 我在应用程序System.Windows.Interactivity.dll中使用。 I have specific version (3.0.40218.0) in my app's Program Files folder. 我的应用程序的“程序文件”文件夹中有特定版本(3.0.40218.0)。 This is the code responsible for loading it: xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" . 这是负责加载它的代码: xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" Problem occurs when user has another version of this dll loaded in GAC_MSIL. 当用户在GAC_MSIL中加载了该dll的另一个版本时,就会出现问题。 Then for some reason both versions of this dll are loaded leading to crash. 然后由于某种原因,此dll的两个版本均被加载,导致崩溃。 Is there any way I can choose specific version to be loaded? 有什么办法可以选择要加载的特定版本?

Is there any way I can choose specific version to be loaded? 有什么办法可以选择要加载的特定版本?

No, the XAML parser will prevent you from using multiple versions of same assembly and trying to add the version number of the assembly to the namespace declaration in XAML will have no effect. 不,XAML解析器将阻止您使用同一程序集的多个版本,并且尝试将程序集的版本号添加到XAML中的名称空间声明中将无效。

It is the reference that decides which assembly that is actually being loaded by the XAML parser. 它是确定XAML解析器实际加载哪个程序集的参考。 If you look in the project file (.csproj), you should be able to see which version of the assembly that you have referenced. 如果查看项目文件(.csproj),则应该能够看到所引用的程序集的版本。

Well it seems that I found the issue. 好吧,看来我找到了问题。 I think it might be bug in .NET. 我认为这可能是.NET中的错误。 In "References" I had old version of file (for .NET 4.0). 在“参考”中,我具有旧版本的文件(用于.NET 4.0)。 If it was cached of course it was loaded, but for some reason also the new dll (for .NET 4.5), that is present in my application's Program Files folder was cached in GAC_MSIL and also loaded. 如果已缓存,则当然会对其进行加载,但由于某种原因,我的应用程序的Program Files文件夹中存在的新dll(用于.NET 4.5)也会被缓存在GAC_MSIL中,并且也会被加载。 So my conslusion is that it accidentally worked with only new version present. 所以我的结论是,它偶然地仅适用于新版本。 Hope it helps someone with similar issue. 希望它可以帮助有类似问题的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM