Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jonathan L Folland 32 posts 174 karma points
    Apr 28, 2015 @ 16:38
    Jonathan L Folland
    1

    Reference to Specific Version AutoMapper causing downstream issues

    The latest Umbraco build has a reference to a specific version of AutoMapper. This was causing conflicts for me. My resolution was to download the source, update the package and build; then I used the built DLLs in my project. So far so good.

    Problem: I wanted to try out LeBlender grid editor. It too had a specific reference to AutoMapper; my guess is due to the fact that it was referencing the same DLLs as the current Umbraco build. So I tried to do the same, download the source, update AutoMapper and build. This failed due to some missing or incorrect source project configuration. I could probably figure out the issue, but instead will just forego use of LeBlender.

    The real issue is the Umbraco specific version. My suggestion would be for Umbraco to fix the current build so that more packages are not created that have this problem as a result.

    Note: I did try to handle this issue through Assembly Binding, but for some reason that did not work. I tried a number of different configurations:

     

    <dependentAssembly>
            <assemblyIdentity name="AutoMapper" culture="neutral" />
            <codeBase version="3.0.0.0" href="AutoMapper.3.0.0\AutoMapper.dll" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="AutoMapper" publicKeyToken="be96cd2c38ef1005" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-2.2.1.0" newVersion="3.3.1.0" />
          </dependentAssembly>
  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Aug 04, 2015 @ 15:17
    Shannon Deminick
    0

    Hi, we've just discovered thanks to twitter that others have had an issue. Automapper 3.1 signs their assembly which means its a huge breaking change and you'd need to rebuild all projects referencing it. See: https://github.com/AutoMapper/AutoMapper/issues/373

    It's very unfortunate because people will upgrade to latest AutoMapper thinking it won't break. You'll have to stick to 3.0 for now.

  • Andy Butland 422 posts 2334 karma points MVP 4x hq c-trib
    Aug 04, 2015 @ 16:40
    Andy Butland
    0

    That's a little spooky... I was literally just looking into trying to fix this in testing the 7.3 beta on an upgraded site. Googled and ended up here just an hour after you posted.

    So does this mean 7.3 will need to change what it's built against, as currently the beta is depending on Automapper 3.3.1?

    Specifically I'm having trouble with Archetype that looks to be built against 3.0.0.

    Andy

  • Tom 713 posts 954 karma points
    Apr 19, 2017 @ 01:06
    Tom
    0

    is there any way to add binding redirects or probing paths to run multiple versions of automapper needed for other packages.. I've tried the following but with no success:

      <dependentAssembly>
        <assemblyIdentity name="AutoMapper" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
        <bindingRedirect oldVersion="3.0.0.1-4.1.1.0" newVersion="4.1.1.0" />
        <bindingRedirect oldVersion="4.1.1.1-6.0.2.0" newVersion="6.0.2.0" />
        <codeBase version="6.0.2.0" href="bin\AutoMapper\v6\AutoMapper.dll" />
        <codeBase version="4.1.1.0" href="bin\AutoMapper\v4\AutoMapper.dll" />
        <codeBase version="3.0.0.0" href="bin\AutoMapper\v3\AutoMapper.dll" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="AutoMapper" publicKeyToken="be96cd2c38ef1005" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
        <bindingRedirect oldVersion="3.0.0.1-4.1.1.0" newVersion="4.1.1.0" />
        <bindingRedirect oldVersion="4.1.1.1-6.0.2.0" newVersion="6.0.2.0" />
        <codeBase version="6.0.2.0" href="bin\AutoMapper\v6\AutoMapper.dll" />
        <codeBase version="4.1.1.0" href="bin\AutoMapper\v4\AutoMapper.dll" />
        <codeBase version="3.0.0.0" href="bin\AutoMapper\v3\AutoMapper.dll" />
      </dependentAssembly>
    
  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Apr 19, 2017 @ 01:56
    Shannon Deminick
    1

    You can do binding redirects via code, for example the only way to do a binding redirect from a non signed assembly to a signed assembly is to do it via code. You can also redirect to specific versions ... however you'll run into issues because you would always need to load the assembly in the "Load" (Fusion) context which means you'd have to do Assembly.Load which would mean the app domain would need to know about it already. You would not be able to use Assembly.LoadFrom and specify a file path because that will not be in the "Load" (Fusion) context and you'll probably run into issues.

    Not sure how the codeBase stuff works but you could try a combination of redirection via code and also specify a few probingPath's: https://msdn.microsoft.com/en-us/library/4191fzwb(v=vs.110).aspx

    Here's the redirection via code example: https://github.com/umbraco/Umbraco-CMS/blob/dev-v7.6/src/Umbraco.Core/BindingRedirects.cs

    And this Initialize method would be need to be called as early as possible, you could use an PreApplicationStartMethod attribute: https://msdn.microsoft.com/en-us/library/system.web.preapplicationstartmethodattribute(v=vs.110).aspx

    Good luck!

  • Tom 713 posts 954 karma points
    Apr 19, 2017 @ 02:07
    Tom
    0

    Thanks Shannon, I'll give it a whirl. Appreciate the time.

  • iiii 15 posts 154 karma points
    Nov 03, 2017 @ 12:53
    iiii
    0

    Any news on this? Im facing the same problem... :/

  • Jonathan L Folland 32 posts 174 karma points
    Nov 03, 2017 @ 23:59
    Jonathan L Folland
    0

    I think I may have pulled leBlender. I cannot quite remember. I do have the binding redirects specified above.

Please Sign in or register to post replies

Write your reply to:

Draft