Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8783467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:50:12+00:00 2026-06-13T20:50:12+00:00

I am compiling a DLL at runtime using CSharpCodeProvider. My code runs fine on

  • 0

I am compiling a DLL at runtime using CSharpCodeProvider. My code runs fine on some machines but on otherse it fails with the following error:

error CS0006: Metadata file ‘EntityFramework.dll’ could not be found

Here is a code snippet:

var csFile = ... // the file is in C:\Program Data\MyFolder\InnerFolder
using (var provider = new CSharpCodeProvider())
{
    var parameters = new CompilerParameters
    {
        GenerateInMemory = false, // we want the dll saved to disk
        GenerateExecutable = false,
        CompilerOptions = "/target:library",

        // the assembly is compiled to the same directory as the .cs file
        OutputAssembly = GetNewCacheAssemblyPath(),
    };

    parameters.ReferencedAssemblies.AddRange(new[]
        {
            "System.dll", 
            "System.Data.dll", 
            "System.Data.Entity.dll", 
            "EntityFramework.dll",
        });

    var compilerResult = provider.CompileAssemblyFromFile(parameters, csFile);
}

Any thoughts as to why this might be happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:50:13+00:00Added an answer on June 13, 2026 at 8:50 pm

    EntityFramework is not part of the .NET framework. So a simple explanation is that the machine this fails on doesn’t have it installed. You are supposed to deploy it yourself. When you use the Nuget package then you’ll have a copy of the DLL in your bin\Release directory. Don’t forget to include it with your shipping binaries.

    Next failure mode is that you did deploy it but the working directory of the program is not where you hope it is. Provide the full path name of the assembly to avoid this. You can use, say, Assembly.GetEntryAssembly().Location to find the path of the EXE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get the following error compiling with make (I have cygwin.dll) *** Couldn't reserve
I have an application that runs fine on .Net 2.0 SP2, but fails to
I'm compiling some MATLAB functions into a C DLL. The exported mlf functions return
I am compiling project in Visual Studio 10, compiled executable runs fine on win
I am compiling a dynamic assembly at runtime. It needs to reference another dll.
I get this warning when compiling my code in VS2008 warning C4275: non dll-interface
While compiling a project i get the following error as c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find lwxmsw28
Recently I opened a .dll file produced by Visual Studio 9 while compiling a
Compiling this code with g++ 4.7.0 ( -Wall -Wextra -Werror -Wconversion -std=c++11 ): #include
When compiling shared libraries in gcc the -fPIC option compiles the code as position

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.