Specified Module cannot be found?

gcollins

Guest
Joined
Sep 13, 2006
Messages
31
Location
Port Hope
Programming Experience
Beginner
Back Again,

Wish I had more than a week to write this program(sigh, got 2 days left)

Here is my problem:

I created an application (runs off of CD) that looks in a directory and displays it in a listview. Depending on what file is clicked an action is taken.

I get the following error when I double click a file in the listview:

"The specified module could not be found. (Exception from HRESULT: 0x8007007E)

************** Exception Text **************
System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at setup.expl_Body.list_Files_MouseDoubleClick(Object sender, MouseEventArgs e)
at System.Windows.Forms.Control.OnMouseDoubleClick(MouseEventArgs e)
at System.Windows.Forms.ListView.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
It works on machines with the .net framework but not on this particular one that doesn't have it. I use Xenocode (www.xenocode.com) to wrap the exe so that it will work on machines that don't have the framework installed. Worked great in the past.

My code for the double click event is as follows:

VB.NET:
Private Sub list_Files_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles list_Files.MouseDoubleClick
    filePath = ""
    fileExtension = ""
    fileName = ""

    Dim indexes As ListView.SelectedIndexCollection
    Dim index As Integer

    If list_Files.IsHandleCreated Then
        indexes = list_Files.SelectedIndices 'Get selected Item's in ListView

        For Each index In indexes
            fileName = list_Files.Items(index).SubItems(0).Text
            fileExtension = list_Files.Items(index).SubItems(1).Text
            filePath = list_Files.Items(index).SubItems(2).Text
        Next

        Select Case fileExtension
            Case ".gif", ".jpg"
                'Send image to PictureBox and show imageViewer Form
                frm_imageViewer.pict_imageDisplay.Image = Image.FromFile(filePath)
                frm_imageViewer.Show()
                frm_imageViewer.Activate()
            Case ".swf"
                'Load Shockwave movie and show Clip Viewer
                frm_clipViewer.AxShockwaveFlash.LoadMovie(0, filePath)
                frm_clipViewer.Show()
                frm_clipViewer.Activate()
                frm_clipViewer.AxShockwaveFlash.Play()
            Case ".pdf"
                Try
                    Process.Start(filePath)
                Catch ex As System.ComponentModel.Win32Exception
                    MsgBox("This document is in .pdf format so you will need the Adobe Reader" & vbCrLf & "or another program that can open this file type.", _
                    MsgBoxStyle.OkOnly + MsgBoxStyle.Information)
                End Try
            Case ".doc"
                Try
                    Process.Start(filePath)
                Catch ex As System.ComponentModel.Win32Exception
                    MsgBox("This document is in .doc format so you will need Micrsoft Word" & vbCrLf & "or another program that can open this file type.", _
                    MsgBoxStyle.OkOnly + MsgBoxStyle.Information)
                End Try
        End Select
    End If
End Sub
I'm new so the error doesn't make sense to me (yet). Can someone explain the error in laymans terms to help me understand.

Could this be a problem with my xenocode program?

Thanks
 
Last edited by a moderator:
"System.IO.FileNotFoundException: The specified module could not be found."

Does this mean the file cannot be found when they click on it? If so it is finding the file when it searches the directory and displays it in the ListView.

And it finds it and runs it on some other machines.
 
I used a program called filemon.exe to monitor my program when it ran what it said was:

Request: Query Information
Path: C:\WINDOWS\system32\mscoree.dll
Result: Not Found
Other: Attributes: Error

What is this dll? do i need to make a reference to it in my application? What do I reference?

Any help would be appreciated.
 
mscoree.dll

VB.NET:
Microsoft.Net Runtime Execution Engine

If you haven't got this dll or it is corrupted then none of your .net apps will work. You don't reference this dll, it is an integral part of .net apps.
If you haven't got it installed on your system then it must have been deleted by spyware or in some cases i've heard anti-virus software can falsely identify this dll as something it should remove. Re-install the framework if it is missing or corrupted.
 
I have tried to repair, didn't work.
Tried a complete uninstall and reinstall and still get the same thing.

Request: Query Information
Path: C:\WINDOWS\system32\mscoree.dll
Result: Not Found
Other: Attributes: Error

Also noticed this (not sure if was there before)

Request: Query Information
Path: ..\Application Data\Microsoft\CLR Security Config\v2.0.50727.42\security.config.cch.1604.9438078
Result: Not Found
Other: Attributes: Error

How come when I build my exe and try it on another machine it can't find these things especially mscoree.dll if it should be part of my program?
 
It's not part of the program, is part of the framework. Since you are using Xenocode it could be a issue with that. I'm sure your exe will run fine if the framework is installed. Maybe worth sending the info to xenocode. For some reason PostBuild isn't binding the MsCoree.dll and form the looks of your last post you are missing a header file from the system security namespace. I doubt this is an issue with VS.Net but more of an issue with Xenocode's postbuild
 
As a test, just install .Net framework itself on the Win 2000 machine, then rebuild your project and put it on the Win 2000 machine. DONT USE XENOCODE

(I actually take exception to anyone bundling an entire virtual machine with an app just to ensure it will run. There's nothing clever about taking a 2Kilobyte App, and bundling a 20 Megabyte framework that ought to be installed for all apps, with it.. You just end up with a Hello World program that is a 20 megabyte download.. Not a good advert of coding skill)
 
Actually this is all that needed to be done (from Xenocode):

Are you depending on any assemblies along side the exe - as opposed to embedding them in the exe?

If so, you will probably need to place a real mscoree.dll (from a .NET 20 install) along side your app's exe. Also, you should create a yourapp.exe.local file (simply empty text file will do) and place it in your app directory.

You're final install directory will look like this:

\AppDir
- YourApp.exe (Processed by Postbuild)
- Library.dll (some managed dependency you are using)
- mscoree.dll (dependency of library.dll)
- YourApp.exe.local (tells the real loader to first look locally for any dependencies)


As far as using Xenocode, Why not? This program will only be running off of CD so this way the user will not have to worry about downloading, or installing anything they don't want too. Program will run no matter what.
 
As far as using Xenocode, Why not? This program will only be running off of CD so this way the user will not have to worry about downloading, or installing anything they don't want too. Program will run no matter what.

It's like providing a copy of Windows that auto-decompresses from CD and installs into memory, with your program, just incase the user doesnt have Windows installed... After all, Windows is as much a pre-requisite as the .NETFW is?

In these cases I normally say:

"This software requires the .NET Framework 2.0 to run. If your system does not have the framework, you can install it by running the DOTNETFX.EXE on the CD and following the instructions"

.NET FW is, after all, used by many programs and every system should have it to run all those apps..

As for the user not wanting to install the framework, that's like the user claiming they dont want to install the Visual C++ Runtimes - then nothing would run properly! As a developer, I feel I have a responsibility to write good code and ensure I dont litter the user's system with junk, but at the same time from the opposite end of the same stick, I feel I have a responsibility to ensure that any enabling technologies I use are properly installed in a clean and sensible manner. Redistributing a copy of the framework without giving the user a choice (packaging tool such as Xeno) not only turns my download from a few hundred kb to several megabytes, but I feel its a little against the moral principles I want to uphold as a developer

Additionally, installing the framework properly is a solid, permanent solution that then comes into line for updates and fixes delivered by Windows Update; something that a bundled-with-the-app version of the framework cannot have.
 
Something else jsut occurred to me; you should check whether youre licensed to redistribute individual parts of the framework. While it may be possible to put one of Microsoft's DLLs alongside your program it might not actually be legal. Check the framework's (or VStudio's) EULA
 
Back
Top