Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EF5 Starting a Project:Error Running transformation: Please overwrite the replacement token '$edmxInputFile$'

I'm creating a Console Project in VS2012 with .Net4.5. After it I "Add", "New Item" to the project, and choose "EF 5.x DbContext Generator". Then, after a couple of seconds the following error message appears in the 'Error List' tab:

Error 1 Running transformation: Please overwrite the replacement token '$edmxInputFile$' with the actual name of the .edmx file you would like to generate from. C:\Projects\Tests\ConsoleAppEF5\ConsoleAppEF5\Model1.tt`

How can I fix this ?

What am I missing ?

like image 527
Gil Avatar asked May 17 '13 13:05

Gil


3 Answers

You should create edmx model first to generate POCO's from it automatically. You can add it through menu (Add New Item -> ADO.NET Entity Data Model). After the model will be created you can use the DbContext generator. Replace $edmxInputFile$ with the name of your edmx file and then save file you are edit (though VS 2012 should do it automatically).

like image 151
eternity Avatar answered Oct 21 '22 22:10

eternity


And in another scenario, this is apparently a known bug: http://web.archive.org/web/20131203074519/http://connect.microsoft.com/VisualStudio/feedback/details/498723/ado-net-entityobject-generator-error-list-bug

So if you add a DbContext Generator and then remove it and you get this error, just close and reopen the project. Solved it for me.

like image 27
Alex Avatar answered Oct 21 '22 23:10

Alex


In my case I was inadvertently adding the EF Db Context Generator instead of Entity Framework. Total PEBKAC but I'm posting it here as I'm sure I will not be the only one.

I noticed that the file extension was TT as this is a text template not the EDMX that I wanted.

If you are looking to add entity then add ADO.NET Entity Data Model not EF X.x DbContext Generator

like image 12
workabyte Avatar answered Oct 21 '22 21:10

workabyte