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

Lee Taylor 31 Reputation points
2024-02-09T21:08:16.0433333+00:00

I have a C# console program that has 2 projects, the main exe and a DLL. Both projects are loaded in VS when i get the error when I try to run as x64 not Any CPU, but I need to run as x64. Since the code for both projects is loaded in VS it should just compile and run as needed. I am at a loss here. Both projects reference the Microsoft.Data.SqlClient NuGit package and both are up to date with the current version.

Azure SQL Database
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,647 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Lee Taylor 31 Reputation points
    2024-02-12T19:27:47.1566667+00:00

    The problem was my DLL library project was written in VB, but the main exe is in c#. So I converted the main exe to VB and everything runs fine.

    0 comments No comments

  2. ShaktiSingh-MSFT 14,406 Reputation points Microsoft Employee
    2024-02-13T09:02:26.69+00:00

    Hi Lee Taylor •,

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue:

    Solution in customer verbatim:

    The problem was my DLL library project was written in VB, but the main exe is in c#. So I converted the main exe to VB and everything runs fine.

    If you have any other questions or are still running into more issues, please let me know.

    Thank you again for your time and patience throughout this issue.

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    0 comments No comments