This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

Proposed Answer This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

  • 16 เมษายน 2555 15:02
     
      มีโค้ด

    Hi guys,

    I am trying to load a custom assembly with “SQL Server MDs Workflow Integration”. However, I get the following error:

    Error loading workflow type extender:

    System.BadImageFormatException: Could not load file or assembly 'WorkflowService' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

    File name: 'WorkflowService'

    The WorkflowService requires ASP.NET 4.0. But, as you can see in the log bellow here, the .Net v2.0 is loaded instead.

    LOG: This bind starts in default load context.

    LOG: Using application configuration file: C:\Program Files\Microsoft SQL Server\110\Master Data Services\WebApplication\bin\Microsoft.MasterDataServices.Workflow.exe.Config

    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.

    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft SQL Server/110/Master Data Services/WebApplication/bin/WorkflowService.DLL.

    ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated.

    - I have set the Application pool to v4.0.

    - ReInstalled .Net 4.0

    - Run the ASPNET_regiis.exe

    - I have even added the following settings into web.config with no results:

                    <startup>
                                    <supportedRuntime version="v4.0" safemode="true"/>
                                    <requiredRuntime version="v4.0" safemode="true"/>
                    </startup>

    Does anyone have experience with this issue?

    This is my code:

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.MasterDataServices.WorkflowTypeExtender; using System.Xml; using System.Data.SqlClient; using System.Diagnostics; namespace MDS { public class WorkflowService : IWorkflowTypeExtender { void IWorkflowTypeExtender.StartWorkflow(string workflowType, XmlElement dataElement) { EventLog.WriteEntry("MDS", "WORKS?", EventLogEntryType.Error); switch (workflowType) { case "BR_Relationship_Default_Items": ExecuteBusinessRule_Items_Defaults(dataElement); break; default: break; } } private void ExecuteBusinessRule_Items_Defaults(System.Xml.XmlElement message) { .....

    } } }


    Project setting:


    • แก้ไขโดย developer554654 16 เมษายน 2555 15:05 removed db settings + cleaned code
    •  

ตอบทั้งหมด

  • 17 เมษายน 2555 20:43
     
     

    I am having the exact same issue.  I posted to a forum yesterday and someone form MS said they would get back to me.

    If I hear anything I will let you know.


    Jonathan

  • 17 เมษายน 2555 21:04
     
     คำตอบที่เสนอ

    I found the solution: 

    - You should develop and compile only in .Net 3.5 and lower.

    - Make sure that also your other assembly references are not 4.0 (check the properties) 

    -  If you are using SQL Server 2012, then use should use Microsoft.MasterDataServices.WorkflowTypeExtender instead of  Microsoft.MasterDataServices.Core.Workflow

    I hope this will help you resolving the issue.

    • เสนอเป็นคำตอบโดย Henry Ong 1 พฤษภาคม 2555 23:42
    •  
  • 17 เมษายน 2555 21:35
     
     

    Thank you.  Wha other references are you referring to?  Th eonly one I ma referencing is this one that is already present Microsoft.MasterDataServices.WorkflowTypeExtender.dll.

    Can I change the properties on this?  Forgive the questions but I ma not a VS developer only a very frustrated Sharepoint archtect whose boss is very upset that the MDS SharePoint workflow feature in SQL 2012 doesn't work.

    Thanks


    Jonathan

  • 18 เมษายน 2555 7:54
     
     

    The one you are using in the correct one. I was refering to the following setting: Runtime Version should be v2.050727

    And make sure that your target framework is NOT v4.0!

  • 18 เมษายน 2555 7:54
     
     

    The one you are using in the correct one. I was refering to the following setting: Runtime Version should be v2.050727

    And make sure that your target framework is NOT v4.0!

  • 18 เมษายน 2555 10:33
     
     

    Thanks.

    When you are building the solution are using  Compile or Embedded Resource for the build Action?  When I use Complie, I receive errors as it does not recognize the SP calsses built in the sample code?


    Jonathan

  • 18 เมษายน 2555 10:58
     
     
    You mean the option "Copy Local" under References? Mine is set to: False
  • 18 เมษายน 2555 12:58
     
     

    That is good to know information but what about these settings?

    SHould BUild Action Be "Complie" or Embedded Resorce? When I use Compile it errors out.

    Thanks


    Jonathan

  • 18 เมษายน 2555 13:29
     
     

    Mine is as follows:

    Build Action: Complie

    Copy to Output Directory: Do not copy

    What you could try is to start a new project and when selecting the template use Frame 3.5 in advance. Maybe that might help.

  • 18 เมษายน 2555 13:45
     
     
    Thanks

    Jonathan

  • 2 พฤษภาคม 2555 8:12
     
     
    Got the problem fixed? Please share your solution.
Unable to Service Request

Unable to Service Request

For the latest headlines and to see what's new, visit the MSDN home page.

Check out the various MSDN Developer Centers where you can find the latest product information, technical resources, and community offerings.

Visit the MSDN Library for the latest technical articles, reference documentation, downloads, and more.
© 2013 Microsoft. All rights reserved.