Friday, 30 November 2007

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

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)


2) 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.

No comments: