0

When moving the POCO generator template into another project, per POCO WalkThrough, the T4 fails to update generated code when model (edmx) changes. Has anyone dealt with problem and know how to resolve it?

Roman
  • 1,177
  • 1
  • 17
  • 25
  • 1
    similar question, meybe helpful (http://stackoverflow.com/questions/2464909/generate-poco-classes-in-different-project-to-the-project-with-entity-framework-m) – Menahem Aug 04 '11 at 16:25

1 Answers1

1

Have you:

A) Updated the POCO T4 file to find the EDMX file in the seperate project?

B) Right-clicked on the POCO T4 file and selected "Run custom tool" to force the T4 to regenerate template files?

sellmeadog
  • 7,437
  • 1
  • 31
  • 45
  • a) Yes, i have modified the .tt file in the entities project to point to the edmx in the other project (otherwise, it would not compile). Also, i've changed the context.tt namespace to match namespace of the moved entities.tt – Roman Aug 04 '11 at 16:30
  • b) I completely missed the option on the context menu. That solved it. I was under impression that the generation should happen automatically. – Roman Aug 04 '11 at 16:36
  • There is also the entry "Transform Templates" in the Project's context menu (in Solution Explorer and Solution Navigator). This will run all T4 templates in the project. – Richard Aug 04 '11 at 17:04
  • 1
    Generation happens automatically only if template is in the same project as EDMX. – Ladislav Mrnka Aug 04 '11 at 21:33
  • @LadislavMrnka: Thank you for this great info! Do you know why this is the case and whether there is a workaround? I try to get the auto-gen work in the same setup in VS 2010 with EF 5.0. Maybe with a similar approach as here: http://stackoverflow.com/questions/12790124/entity-framework-5-stopped-running-t4-templates-files-on-save?rq=1 using 'DependentUpon' in the POCOs project file? – juniper Jan 14 '13 at 19:50