2016-09-15 31 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)