2016-09-15 28 views
1

我使用Visual Studio 2015年后发布,当我点击.application文件发布一个WPF应用程序,它抛出这个错误:的ClickOnce需要System.Windows.Interactivity版本4.5.0.0

Unable to install or run the application. The application requires that assembly System.Windows.Interactivity Version 4.5.0.0 be installed in the global assembly cache (GAC) first.

的我应用中的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中的错误列表选项卡,它具有以下警告:

Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.

什么我做错了吗?谢谢。

+0

找到解决方案:在Nuget包管理器的Extensions下有一个4.5版本的DLL。首先删除4.0版本,然后添加4.5版本。再次发布,并且安装时没有问题。 – Alex

回答

1

显然,MVVM Light Toolkit在项目中安装了4.5版本的System.Windows.Interactivity,这与4.0版本相冲突。解决方案:

  1. 展开项目参考。
  2. 找到System.Windows.Interactivity
  3. 右键单击它并选择删除。
  4. 右键单击引用并选择添加引用。
  5. 在Assemblies> Extensions下,选中System.Windows.Interactivity 4.5.0.0版。
  6. 单击确定关闭参考。

现在再次发布,安装程序正常工作。作为上述研究造成冲突的一部分,我建立了,它生成了详细的日志。在大约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)