Copied to clipboard

Flag this post as spam?

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


  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Aug 28, 2013 @ 19:52
    Nicholas Westby
    0

    Unable to Resolve References to Contour Assemblies

    When I compile, I get the error "The type or namespace name 'Forms' does not exist in the namespace 'Umbraco' (are you missing an assembly reference?)". The offending line of code is (I am trying a code first approach to creating Contour forms):

    public class SubscribeToNewsletter : Umbraco.Forms.CodeFirst.FormBase { }

    Yes, I have a reference to Umbraco.Forms.CodeFirst, Umbraco.Forms.Core, and Umbraco.Core.Providers. And Visual Studio intellisense showed me that the class "FormBase" is in the namespace "CodeFirst".

    The problem seems to be related to the fact that, even though I have referenced the Contour assemblies, the references cannot be resolved, as indicated by this compile warning:

    The primary reference "Umbraco.Forms.CodeFirst, Version=3.0.15.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Web.Extensions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5". To resolve this problem, either remove the reference "Umbraco.Forms.CodeFirst, Version=3.0.15.0, Culture=neutral, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Web.Extensions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".

    There are a total of 6 warnings, each of which look very similar to this one. I added emphasis above to point out what the main problem seems to be (i.e., something is referencing System.Web.Extensions 1.1.0.0). Note that I have binding redirects in my web.config for the old versions of this and the related assemblies:

    <dependentAssembly>
     <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="4.0.0.0" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="4.0.0.0" />
    </dependentAssembly>

    I tried to use dotPeek to find out where the assembly reference was coming from, but dotPeek seems to have a bug that made inspecting the reference hierarchy impossible (infinite hang). I also set MSBuild project build output verbosity to detailed, and it didn't provide any useful information.

    I am using Umbraco 6.1.3 in an MVC4 project targeted against the .Net Framework 4.5. I installed Contour 3.0.14.0 from the repository in Umbraco, then noticed a new version, so I downloaded the upgrade package for Contour 3.0.15.0 and updated the DLL's in my project (note that I have experienced the same error/warnings before and after this Contour upgrade).

    Any ideas to help troubleshoot this would be much appreciated.

  • Comment author was deleted

    Aug 28, 2013 @ 19:58

    Will see what I can do about that, just looking at the project it's targeted at .net framework 4

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Aug 28, 2013 @ 21:00
    Nicholas Westby
    0

    I'm still looking into this myself. The only thing that sticks out to me so far is that Umbraco.Licensing has references to the 2.0 versions of mscorlib, System, System.Web, System.Web.Services, and System.Xml. It also has a reference to the 3.5 version of System.Core.

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Aug 29, 2013 @ 00:18
    Nicholas Westby
    0

    I may have found the problem. Umbraco.Forms.References has references to version 1.0.61025.0 of System.Web.Extensions and System.Web.Extensions.Design. Though, I'm not sure why my binding redirects wouldn't work for that. And I'm not sure how to fix it.

  • Comment author was deleted

    Aug 29, 2013 @ 10:09

    Hmm that's strange never seen that issue before, binding redirect should do the trick , references is basicly an ilmerge of some third party stuff

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Aug 29, 2013 @ 19:15
    Nicholas Westby
    101

    I got it working (the compile errors are gone, anyway... I will have to work on some runtime issues later). Not sure exactly what I did that got it working, but here are the steps I took:

    • Modified the "oldVersion" attribute of the bindingRedirect to go all the way up to 4.0.0.0 rather than just to 1.1.0.0.
    • Added xmlns to the dependentAssembly tags rather than just the assemblyBinding tag.
    • Reverted to Contour 3.0.14.0.

    Here are what my binding redirects look like now:

    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <!-- Old asp.net ajax assembly bindings -->
       <dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1">
         <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
         <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
       </dependentAssembly>
       <dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1">
         <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
         <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
       </dependentAssembly>
       <!-- ...and so on... -->
    </runtime>
Please Sign in or register to post replies

Write your reply to:

Draft