Question

I am currently trying to run a C# program which I created using Microsoft Visual C# 2005 on a Windows CE v6.0 Machine which is a barcode scanner/pocket PC. It is a console program, but when I run the program, I'm getting the error:

File or assembly name 'MySql.Data,Version=6.7.4.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D' , or one of its dependencies was not found.

Looking at the details, it is a TypeLoadException.

Here is my app.manifest file:

<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <applicationRequestMinimum>
        <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
        <defaultAssemblyRequest permissionSetReference="Custom" />
      </applicationRequestMinimum>
    </security>
  </trustInfo>
    <system.data>
        <DbProviderFactories>
            <remove name="MySQL Data Provider" />
            <add name="MySQL Data Provider"
                invariant="MySql.Data.MySqlClient"
                description=".Net Framework Data Provider for MySQL"
                type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
        </DbProviderFactories>
    </system.data>
</asmv1:assembly>

EDIT If the error above doesn't appear, another similar one shows up:

File or assembly name 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089', or one of its dependencies, was not found.
Was it helpful?

Solution

The error means that your application cannot find the ADO Data provider for MySQL that you specified when you created the app. Its most likely, you simply did not copy it over to your Windows CE machine.

To locate it: Go into your Visual Studio, and open the "References" under your project in the solution explorer. Find the Mysql entry and select it. The Properties window will identify the path to the dll.

Copy that dll into the same directory as your executable on the Win CE machine.

OTHER TIPS

You could try to enable Fusion Log Viewer to see exactly which library is causing the problem (like described here: http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx). It could happen that you will need to run it few times, if there are a batch of dll's missing

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top