我正在使用Visual Studio 2015发布一个WPF应用程序。发布后,当我单击.application
文件时,它会抛出此错误:
无法安装或运行该应用程序。该应用程序要求首先在全局程序集缓存(GAC)中安装程序集System.Windows.Interactivity版本4.5.0.0。
我的应用中System.Windows.Interactivity
的版本是4.0.0.0。那么为什么要求4.5.0.0呢?我甚至无法在网上找到该版本。
基于this question,我更新了我的app.config
以获得此功能,但无济于事:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Windows.Interactivity" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.5.0.0" />
</dependentAssembly>
</assemblyBinding>
在Visual Studio的“错误列表”选项卡中,它具有以下警告:
发现无法解析的同一依赖程序集的不同版本之间发生冲突。当日志详细程度设置为详细时,这些引用冲突将在构建日志中列出。
我做错了什么?感谢。
答案 0 :(得分:1)
显然,MVVM Light Toolkit在项目中安装了4.5版本的System.Windows.Interactivity
,这与4.0版本相冲突。解决方案:
System.Windows.Interactivity
。System.Windows.Interactivity
版本4.5.0.0。现在再次发布,安装程序正常。作为上述导致冲突的原因的研究的一部分,我enabled diagnostic output用于构建,它生成了详细的日志。约2000行,包括:
Unified Dependency "System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". (TaskId:13)
1> Using this version instead of original version "4.0.0.0" in "C:\Users\myUserName\Documents\Visual Studio 2015\Projects\MyProject\packages\Blend.Interctivity.WPF.v4.0.1.0.3\lib\net40\Microsoft.Expression.Interactions.dll" because of a binding redirect entry in the file "App.config". (TaskId:13)
1> Resolved file path is "C:\Users\myUserName\Source\Workspaces\Workspace\packages\MvvmLightLibs.5.2.0.0\lib\net45\System.Windows.Interactivity.dll". (TaskId:13)
1> Reference found at search path location "C:\Users\myUserName\Source\Workspaces\Workspace\packages\MvvmLightLibs.5.2.0.0\lib\net45". (TaskId:13)
1> For SearchPath "C:\Users\myUserName\Source\Workspaces\Workspace\packages\MvvmLightLibs.5.2.0.0\lib\net45". (TaskId:13)
1> Considered "C:\Users\myUserName\Source\Workspaces\Workspace\packages\MvvmLightLibs.5.2.0.0\lib\net45\System.Windows.Interactivity.winmd", but it didn't exist. (TaskId:13)
1> Required by "GalaSoft.MvvmLight.Platform, Version=5.2.0.37226, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL". (TaskId:13)
1> Required by "Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". (TaskId:13)
1> This reference is not "CopyLocal" because it conflicted with another reference with the same name and lost the conflict. (TaskId:13)
1> The ImageRuntimeVersion for this reference is "v4.0.30319". (TaskId:13)