Conflict with Microsoft.Practices.ServiceLocation ?

Feb 9, 2013 at 6:55 PM
I've got an issue where my WPF application cannot be published with ClickOnce.

The application uses Nuget packages MVVM Light 4.1.26.1, Unity 2.1.505.2, CommonServiceLocator 1.0.

The problem is that when I publish, it all build fine, but I get this error when I try and install the clickonce package:

Unable to install or run the application. The application requires that assembly Microsoft.Practices.ServiceLocation Version 1.0.0.0 be installed into the Global Assembly Cache (GAC) first.


I did some digging and saw that there were two references to that assembly in the manifest, and one of them was marked as a prerequisite which I can't get rid of:
<dependency>
    <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
      <assemblyIdentity name="Microsoft.Practices.ServiceLocation" version="1.0.0.0" publicKeyToken="59D6D24383174AC4" language="neutral" processorArchitecture="msil" />
    </dependentAssembly>
  </dependency>

<dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Microsoft.Practices.ServiceLocation.dll" size="29760">
      <assemblyIdentity name="Microsoft.Practices.ServiceLocation" version="1.0.0.0" publicKeyToken="31BF3856AD364E35" language="neutral" processorArchitecture="msil" />
      <hash>
        <dsig:Transforms>
          <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
        </dsig:Transforms>
        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
        <dsig:DigestValue>eee+a+dQmhpSY/ApLxRipXdEp8UsTaZHXHClBU0Iwyc=</dsig:DigestValue>
      </hash>
    </dependentAssembly>
  </dependency>
I'm pretty sure the issue with the ClickOnce is down to there being two references to this assembly with the same version (but notice the different public key tokens).

I created a very simple repro as follows:
  1. Create a new WPF application
  2. Add Nuget package MVVM Light
  3. Add Nuget package Unity
  4. Build and publish the WPF application
  5. Try and install the published MyApp.application clickOnce package....get the error detailed above
Here's a repro project:

Skydrive repro project link

Any ideas how I might get over this?
Coordinator
Feb 14, 2013 at 7:26 PM
Hi,

Please try again. I just pushed a new build (4.1.27.0) to Nuget that is depending on the official CommonServiceLocator package where available. This should fix your issue. If you have more problems, please make sure to let me know.

Cheers
Laurent
Feb 16, 2013 at 8:38 AM
Mr Bugnion you are a legend, this has fixed all my woes. Kudos on the speedy turnaround....cheers!