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 594223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:55:50+00:00 2026-05-13T15:55:50+00:00

I am in the process of build a script for a fairly big project.

  • 0

I am in the process of build a script for a fairly big project. One of the projects require an Entity Framework Model to be compiled into a library. Due to the way the build server works, all builds are hand crafted to manage the various deployment scenarios without affecting the developers and the project files.

Is there anyway to generate the EF Model using an MSBuild task without using the project file generated by Visual Studio? Currently the actual assembly compiles using a CSC task, however the actual deployed application fails because the EF Model is not included in the compiled assembly.

Any pointers into which Targets or Build Tasks can be used to generate the model and create the required resources to embed in the assembly?

Please Note

The project compiles fine in Visual Studio, however using the project file on the build server is not an option, as there is various changes that needs to be made to the project at deployment time, and this is controlled through a custom build script outside of the development teams control. This has worked succesfully for a few projects, however the EF Model is causing some headaches in this specific scenario.

Update

The current solution is not ideal but works. The Project file has been modified to copy the EF Model resources to a folder in the project on a new release build, which is then checked into source control. When the build script runs on the server the EF models are embedded into the assembly. This seems to be a workable workaround for the moment.

  • 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-05-13T15:55:50+00:00Added an answer on May 13, 2026 at 3:55 pm

    I actually dealt with this today since my project’s source tree isn’t properly setup to run the Entity Framework’s build task which generates and embeds the resources in the output dll.

    I investigated the following options:

    Using the EntityDeploy msbuild task

    If you open your .csproj file in notepad you should see a bit of XML like

     <EntityDeploy Include="MyEntities.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>MyEntities.Designer.cs</LastGenOutput>
     </EntityDeploy>
    

    This is the msbuild task that uses Microsoft.Data.Entities.Build.targets and Microsoft.Data.Entities.Build.dll to read the edmx file, generate the ssdl, csdl, and msl files and then embed them in the target dll. (These files can be found in C:\Windows\Microsoft.NET\Framework\v3.5).

    Using EdmGen

    As Craig pointed out, you might be able to use EdmGen.exe which ships with the framework. I gave that a go but I had done a bit of customization to the data in my edmx file and EdmGen.exe seems to really want to do the initial generation from the original database.

    Using EdmGen2

    EdmGen2.exe is an open-source project that does a bit more than EdmGen. I ended up using it to generate the ssdl, csdl, and msl files. You can just point it at your edmx file and it will generate the necessary ssdl, csdl, and msl files. I then included these alongside my dll and modified the connection string from

    connectionString="metadata=res://*/MyEntities.csdl|res://*/MyEntities.ssdl|res://*/MyEntities.msl;
    

    to

    connectionString="metadata=./MyEntities.csdl|./MyEntities.ssdl|./MyEntities.msl;
    

    Note I’m telling the Entity framework that these files are in the same directory as my dll, not embedded as resources.

    All three of these, the build task, EdmGen, and EdmGen2 are thin wrappers that call System.Data.Entity.dll for all of the hard stuff. As a last resort you could peek at the build task dll in reflector and see what it’s doing.

    Hope this helps.

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

Sidebar

Related Questions

I'm currently in the process of replacing my homebrewn build script by an Ant
As part of our build process we run a database update script as we
Our build process uses Visual Studios 2003 link.exe for linking. On one machine we're
I am creating a new build process for a DotNet project which is to
How can we make our build process (Dev Studio 2005) for a .NET project
My build process consists of Qt's qmake Makefile generator and the typical make utility
During our build process we run aspnet_compiler.exe against our websites to make sure that
My automated build process uses a command-line to build something like this: devenv.exe myproj.sln
Thinking about a Windows-hosted build process that will periodically drop files to disk to
How would you manage the lifecycle and automated build process when some of the

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.