Could not load file or assembly stdole

15,852

Solution 1

Just in case anyone else encounters the issue the same way I did...

This is how I resolved the issue:

Deleted the existing reference to stdole, then added a reference > extensions > there were four entries for stdole! one with the office icon, one with the VS icon, one with a cog (setup icon) and another with no icon (all four were exactly the same version numbers etc)...

Added a reference to the one with VS icon and deployed to server... all going well (touch wood)

Solution 2

Add a reference in your project to 'stdole.dll', which can be found in a couple of different places

  • Your GAC (C:\Windows\assembly)
  • C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\PublicAssemblies

Rebuild, redeploy and all should be good.

Solution 3

There is now a Nuget package which provides stdole.dll:

https://www.nuget.org/packages/stdole

So today this may be the most reliable way of including it in your project, if you don't want to assume it is in the GAC or if you need a specific version. There are versions going from 17.0.0 (preview) all the way back to 7.0.3300, although not contiguously. (Not sure if they jumped version numbers or if some are actually missing?)

Share:
15,852
Paul Zahra
Author by

Paul Zahra

Sole I.T. Developer using: AJAX, AGILE, C# 1.0 - 7, Entity Framework 1.0 - 4.7, JQuery, Linq (including Linq to Entities, Linq to SQL and Linq to XML), MVC 1.0 - 6.0, Oracle PL/SQL, SQL Server 2005 - 2015, T-SQL, Telerik (Kendo UI mainly), TeamCity, SVN (Tortoise), Visual Studio 97 - 2017, Web API / WCF and a little Unit Testing and Crystal Reports.

Updated on September 14, 2022

Comments

  • Paul Zahra
    Paul Zahra over 1 year

    Just installed VS2015 side by side with VS2010...

    Application in issue was built using VS2010 (set to use .Net 4.0) (not migrated to VS2015) worked fine on my machine, put it on server and fell over in a heap... stdole was the issue...

    In the error Windows Logs > Applications there was an exception:

    Exception information: 
    Exception type: ConfigurationErrorsException 
    Exception message: Could not load file or assembly 'stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)
       at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
       at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
       at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
       at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
       at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
       at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)
       at System.Web.Compilation.BuildManager.ExecutePreAppStart()
       at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
    
    Could not load file or assembly 'stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at     System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
       at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
       at System.Reflection.Assembly.Load(String assemblyString)
       at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
    
    Could not load file or assembly 'stdole' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)
    
    Stack trace:    at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
       at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
       at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
       at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
       at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
       at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)
       at System.Web.Compilation.BuildManager.ExecutePreAppStart()
       at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
    

    Looked at reference to stdole and it was to the GAC and to a Version: 2.0.0.0

    The bitness of nothing has changed.

    Where on earth has this error come from?

  • Paul Zahra
    Paul Zahra about 8 years
    Indeed, I suspect though that installing VS2015 side by side with VS2010 and their accompanying .Net frameworks have caused this issue.
  • StayOnTarget
    StayOnTarget almost 3 years
    When you deployed, was stdole included in your deployment files? How specifically did this differ from what it was doing originally?