Tuesday, July 1, 2008

System.IO.FileNotFoundException: Could not load file or assembly 'stdole, Version=7.0.3300.0

All of a sudden I started to get this error when deploying the application, without getting this error on the development machine.  It turns out that the problem has to do with .NET 2.0.  Apparently, the latest version does not include this file in the GAC.  And my application is looking for the file there .  There seems to be a number of possible fixes for this error.  The one that worked for me,  I got from the following website:

http://forums.msdn.microsoft.com/en/clr/thread/426dfa9c-1ab7-4b3e-9474-99edb377fcb6/

To summarize:
1.  Right click on the stdole.dll in the reference section of project and select local copy true. By default it will be false.  This will tell the application not to get it from the GAC.
2.  Add the file to your application.  In your setup application, go to View->Editor->File System.  In the pane that opens up, right click and select Add->Assembly.  Go to the following location:
C:\Program Files\Microsoft.NET\Primary Interop Assemblies and select stdole.dll.

Recompile your application and it should now work.

Below are some other suggestions:
- Remove the reference from your project (I couldn't do this as I use an old FlexGrid and it used it).
-
In "Project-Properties" - "Publish" - "Application Files..." - "stdole.dll" set "publish Status" to "Include". (I already had the file included when I got the problem).
- From the command-line run gacutil with the stdole.dll.  This is a workaround to get it up and running fast, but defeats the idea of having a setup application.

some other sites where people asked this question:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=9506&SiteID=1
http://forums.msdn.microsoft.com/en-US/vbgeneral/thread/17d097ae-9465-4a0d-82f1-5005b7dc26e0/

No comments: