Alex
Alex

Reputation: 35831

ClickOnce requires System.Windows.Interactivity Version 4.5.0.0

I'm publishing a WPF app using Visual Studio 2015. After the publish, when I click the .application file, it throws this error:

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.

The version of System.Windows.Interactivity in my app is 4.0.0.0. So why would it be asking for 4.5.0.0? I can't even find that version on the web.

Based on this question, I updated my app.config to have this, to no avail:

<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>

In the Error List tab of Visual Studio, it has the following warning:

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.

What am I doing wrong? Thanks.

Upvotes: 2

Views: 4025

Answers (1)

Alex
Alex

Reputation: 35831

Apparently, MVVM Light Toolkit installs a 4.5 version of System.Windows.Interactivity in the project, and that was conflicting with the 4.0 version. Solution:

  1. Expand project references.
  2. Locate System.Windows.Interactivity.
  3. Right-click it and choose Remove.
  4. Right-click References and choose Add Reference.
  5. Under Assemblies > Extensions, check the box for System.Windows.Interactivity version 4.5.0.0.
  6. Click OK to close the references.

Now publish again and the installer works fine. As part of the above research into what was causing the conflict, I enabled diagnostic output for the build, which generated a verbose log. On about line 2,000, it included this:

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)

Upvotes: 2

Related Questions