Structure map with epi cms 9

Vote:
 

Hi all,

When I update the latest EpiServer package to version 9,compile that successfully,but when I running web,the web browser shows the following error message:

Could not load file or assembly 'StructureMap, Version=3.1.6.186, Culture=neutral, PublicKeyToken=e60ad81abae3c223' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'StructureMap, Version=3.1.6.186, Culture=neutral, PublicKeyToken=e60ad81abae3c223' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I don't know what happened.The web porject have installed the latest structuremap nuget package to 3.1.6.186, and add binding in web config as the following:




Any ideas about that?please feel  free to comment it then thanks a lot.

#139281
Sep 29, 2015 10:32
Vote:
 

From the release notes:

The StructureMap dependency has been updated to the latest major version. The changes in the EPiServer Library are minimal, but there are some major changes to the StructureMap API that may affect any usage. See the StructureMap release notes for further details. EPiServer Framework 9.0.0 will require the signed version of StructureMap (packages structuremap-signed and structuremap.web-signed). Depending on version of NuGet you have installed, the old version of structuremap (2.6.4.1) may have to be uninstalled manually.

#139303
Sep 29, 2015 12:46
Vote:
 

@Johan,Thanks for your help.but I've also installed the following dependencies from Episerver.framwork package:

<package id="structuremap.web-signed" version="3.1.6.191" targetFramework="net451" />
<package id="structuremap-signed" version="3.1.6.191" targetFramework="net451" />

I've uninstalled the old version of structuremap(2.6.4.1) ,and my project has not code to using structuremap.

So I don't know any direction for this issue.

Further information:I updated all episerver nuget packages to version 9 with –IgnoreDependencies options.

#139305
Edited, Sep 29, 2015 13:26
Vote:
 

I find one of reson for this issue,because structuremap-signed package used structuremap version for 3.1.6.191.

Then I replace structuremap to use this version and point to structuremap.dll inside the package "structuremap-signed",now after I build it sucessfully,and the error message changed the following text:

Method not found: 'StructureMap.Configuration.DSL.Expressions.CreatePluginFamilyExpression`1<!!0> StructureMap.Configuration.DSL.Registry.For()'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.MissingMethodException: Method not found: 'StructureMap.Configuration.DSL.Expressions.CreatePluginFamilyExpression`1<!!0> StructureMap.Configuration.DSL.Registry.For()'.

So there might be strange configuration in the latest EpiServer CMS?

#139313
Sep 29, 2015 17:43
Vote:
 

Hi,

Can you try with 3.1.6.186 version?

/Q

#139316
Sep 29, 2015 19:24
Vote:
 

@Quan,

I've tried StructureMap 3.1.6.186,but what I said as the previouse error:

 

Could not load file or assembly 'StructureMap, Version=3.1.6.186, Culture=neutral, PublicKeyToken=e60ad81abae3c223' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

And shoulde we install StructureMap package yet?Maybe the structuremap should be replaced with structuremap.web-signed package.

#139340
Sep 30, 2015 12:10
Vote:
 

I had a similar issue. 

In my case the EPiServer.GoogleAnalytics addon was the the cause. The addon required the older version of structuremap. Deleting the addon solved the problem

#139350
Sep 30, 2015 14:15
Vote:
 

@Jens,Thanks for your information.I also used Episerver.GoogleAnalytics nuget package,but if we remove that,what to do for adding this feature?

#139353
Sep 30, 2015 14:54
Vote:
 

The new structuremap version has been split into three assemblies: structuremap, structuremap.net and structuremap.web

The problem you're seeing might be a component (typically an add-on) that is using structuremap in an initializable module to configure the container. I've seen the same error message ("Method not found: 'StructureMap.Configuration.DSL.Expressions.CreatePluginFamilyExpression`1<!!0> StructureMap.Configuration.DSL.Registry.For()'") when the add-on was configuring using HttpContextScoped.

Since the HttpContextScoped extension method has been moved into the structuremap.web assembly it also requires a "using StructureMap.Web" when running with CMS 9, which the add-on typically does not have.

I can't see an easy workaround without getting updated add-ons that work with CMS 9.

#139354
Sep 30, 2015 15:03
Vote:
 

@Steve,I used the latest Episerver.GoogleAnalytics nuget package.I don't know why Episerver CMS 9 has not updated this package to be compatiable with this.

It seems to be like when we use Episerver.GoogleAnalytics we can't update cms to version 9.

#139356
Sep 30, 2015 15:20
Vote:
 

CMS 9 is brand new, and not all of the add-ons have been released in CMS 9 compatible versions. The Google Analytics version available in the feed right now isn't supporting CMS 9 (EPiServer.CMS.Core (≥ 8.0 && < 9.0)).

Rest asured that the add-on team is working hard on releasing all of these in compatible versions.

#139363
Sep 30, 2015 22:16
Vote:
 

Ok,I will be removing EpiServer.GoogleAnalytics to make sure of updating cms correctly.

#139376
Oct 01, 2015 9:37
Vote:
 

For reference; the solution should be to add an assemblybinding like the following:

      <dependentAssembly>
        <assemblyIdentity name="StructureMap" publicKeyToken="e60ad81abae3c223" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-20.0.0.0" newVersion="3.1.6.191" />
      </dependentAssembly>

The value "3.1.6.191" may vary depending on your version, check the Version property for the StructureMap.Net reference under the References node in your project.

#146903
Mar 30, 2016 13:07
Vote:
 

Did anyone found a workaroud for this error? Even though I am not using EpiServer.GoogleAnalytics I still get this error , when i recently upgraded my framework from 7.5 to 9.12

#161202
Oct 07, 2016 20:13
Vote:
 

Shreya, it does not have to be the GoogleAnalytics package, it could be some other component. Check your modulebin folder for any leftovers, empty your bin folder and do a rebuild to bring in all the references again.

#161203
Oct 07, 2016 20:19
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.