janaka.co.uk

Entity Framework beta 2 + VS 2008 Beta2: Manually copying an .edmx file to a new project

30 November 2007

I’ve recently started to play with the new ADO.Net Entity Framework.
This is bleeding edge stuff (Beta/CTP) from Microsoft so I wasn’t too
surprised when I started hitting a few issues with the tools and VS
2008. As expected there isn’t a great deal of useful documentation out
there yet (just the same basic stuff over and over again) which meant
when I hit these issues there wasn’t a lot of answers out there. I
thought I’d start blogging about issues I come across.

Here’s issue number one for me

Problem:
When I copy an .edmx file from one project to another manually the
.csdl, .msl, and .ssdl files aren’t created on compile neither is the
code behind re-generated

Solution:

  1. solution explorer > click on the EDMX file > ‘custom tool’ =
    ‘EntityModelCodeGenerator’

This auto re-generates the class from the EDMX file (CSDL more
accurately I think)

  1. project properties > compile > click ‘build events’ > ‘edit
    post-build’ and paste the following including all double-quotes

“%windir%\Microsoft.NET\Framework\v3.5\EdmxDeploy.exe” ”$(ProjectDir) ”
”$(TargetDir) ”

this re-generates the .csdl etc. into the output dir on project build.


Personal blog by Janaka Abeywardhana. Thoughts on topics other than Software Engineering and Product Management. All of that is over at [janaka.dev](janaka.dev) by Janaka Abeywardhana. On Github, Twitter, and Instagram

© 2000-2021. Built with Gatsby. Deployed on the Distributed Web using IPFS and Fleek