locked
Could not load file or assembly 'msshrtmi' RRS feed

  • Question

  • Hi,

     

    This error has recently occurred in a LightSwitch implementation that previously worked.

     

    It occurs when attempting to debug the application for any platform.

     

    I've rebuilt VS2010 recently, which fixed several bugs but not this one.

     

    Full error below.  Why is this happening?

     

    Server Error in '/' Application.

     

    Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.

     

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Assembly Load Trace: The following information can be helpful to determine why the assembly 'msshrtmi' could not be loaded.

    === Pre-bind state information ===
    LOG: User = resportable\andy
    LOG: DisplayName = msshrtmi
     (Partial)
    WRN: Partial binding information was supplied for an assembly:
    WRN: Assembly Name: msshrtmi | Domain ID: 3
    WRN: A partial bind occurs when only part of the assembly display name is provided.
    WRN: This might result in the binder loading an incorrect assembly.
    WRN: It is recommended to provide a fully specified textual identity for the assembly,
    WRN: that consists of the simple name, version, culture, and public key token.
    WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
    LOG: Appbase = file:///C:/Users/andy/Documents/Visual Studio 2010/Projects/MedTekLS/MedTekLS/Bin/Debug/
    LOG: Initial PrivatePath = C:\Users\andy\Documents\Visual Studio 2010\Projects\MedTekLS\MedTekLS\Bin\Debug\bin
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: C:\Users\andy\Documents\Visual Studio 2010\Projects\MedTekLS\MedTekLS\Bin\Debug\web.config
    LOG: Using host configuration file: 
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\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:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/691ac3ea/666317c4/msshrtmi.DLL.
    LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/691ac3ea/666317c4/msshrtmi/msshrtmi.DLL.
    LOG: Attempting download of new URL file:///C:/Users/andy/Documents/Visual Studio 2010/Projects/MedTekLS/MedTekLS/Bin/Debug/bin/msshrtmi.DLL.
    ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
    


    Stack Trace:

    [BadImageFormatException: Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
       System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
       System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +45
       System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +141
       System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
       System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +23
       System.Reflection.Assembly.Load(String assemblyString) +28
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38
    
    [ConfigurationErrorsException: Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752
       System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +220
       System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +134
       System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +174
       System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91
       System.Web.Compilation.BuildManager.CallPreStartInitMethods() +331
       System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516
    
    [HttpException (0x80004005): Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10556500
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
       System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +252
    

     


    Dr Andy Edmonds, Scientio LLC
    Tuesday, October 25, 2011 6:27 PM

All replies

  • Any luck with this? I have had this happen twice now.  My solution includes a web application and an Azure project.  I only get this error on the web application.
    Brendon Birdoes, Neudesic
    Friday, October 28, 2011 1:15 AM
  • No, no solution so far. I have found that the error only applies during local debuging.

    When I upload the solution to azure it runs properly.

     

    Andy


    Dr Andy Edmonds, Scientio LLC
    Friday, October 28, 2011 8:06 AM
  • I've seen this several times now. Managed to get rid of it in 1.4 and 1.5 and now it's back in 1.6. If you remove the Azure assemblies from the web project the problem should go away. It's because of the target platform x64/x32 confusion. A couple of things previously worked for me from posts I saw.

    1. Edit the web project file and remove the <TargetPlatform> attribute.

    2. Then swap to x64 as a new target in your project properties.

    3. You can also try and have a post build event which deletes the msshrtmi file from the bin directory.

    Initially 1 worked for me but the tag didn't exist in all of my projects so combinations of 2 and 3 always seemed to work.

    Currently this new strain of cross platform nightmare seems to be more virulent and none of the steps above work for me this time round. Hope they work for you. 

     

    Richard Conway

    London Windows Azure User Group http://www.lwaug.net

     

    • Proposed as answer by Aarthyk Tuesday, February 14, 2012 5:52 PM
    • Unproposed as answer by Aarthyk Tuesday, February 14, 2012 5:52 PM
    Wednesday, November 23, 2011 6:40 PM
  • I just abruptly started to receive this.

     

    I can tell you the one thing I did that might have triggered it is install an update to my SQL Management studio in order for me to be able to connect to my Azure SQL Database and fixed some other bugs.

    SQLManagementStudio_x86_ENU.exe

     

    Sunday, December 4, 2011 11:02 PM
  • I just met similar error message when i debug ordinary WCF web service (the customerservice sample in http://blogs.msdn.com/b/chriskeyser/archive/2011/10/19/bcs-developing-a-net-assembly-connector-presentation-and-demo.aspx)

    fixed by choosing the correct Platform Target (from Itanium which i choose by mistake to AnyCPU).

    • Proposed as answer by kishore ahmed Monday, May 28, 2012 5:03 PM
    Friday, April 13, 2012 10:51 AM
  • Hi

    I ran in to the same problem. The msshrtmi comes in a 32 and 64 bit version. for some reason it somtimes pices the wrong verion. I resolved te problem by removing the reference from the project and adding it again through the browes option in the add reference dialog. You can the pick the correct (32 or 64) version.

    Michiel

    Friday, April 12, 2013 10:49 AM
  • I had this error and fixed it by checking:

    Options->Debugging->General enable "Just My Code" (which I had disabled for a different error on a different solution).

    Hope this helps someone!

    Scott

    Wednesday, August 28, 2013 8:50 PM
  • I got same error with VS 2013. Removed Azure deployment project and added new one, it fixed my issue.

    Ashish

    Wednesday, February 12, 2014 6:45 AM