Entity Framework 5 POCOs not included in TFS?
I'm working on project where we recently upgraded to Entity Framework 5. After we upgraded I created a new .edmx model and moved all out entities over to the new model.
From what I can tell Entity Framework 5 runs of POCO objects. The problem I'm having is that POCO objects don't seem to be included in source control. If a new developer opens the solution it doesn't include any generated POCO objects. To get around this we can right click "MyModel.Context.tt" and "MyModel.tt" and click "run custom tool" to generate the POCO objects. So is there a way to include the POCO objects in tfs so we don't have to generate them when a new dev opens the solution?
So I tried what a few people have suggested and use "include in project" but if I look at the the folder that contains the model in visual studio with the show all files options on none of the classes show up. BUT if I look at the folder with windows explorer it shows all the files... what give?
Further to Saml's Answer above...
For Visual Studio 2012, in order to add your POCO's do the following;
- Open the Team Explorer Window using View>Team Explorer
- You will see a list of shortcuts... My Work, Pending Changes and so on;
- Under "Pending Changes" is a link to "Source Control Explorer"
- Click this link, to open the Source Control Explorer Window
- Navigate through your solution to the Project containing your edmx file
- Above the "Source Location" will be a toolbar
- The fourth icon from the left is "Add Items To Folder"
- Clicking this icon will bring up the "Add to Source Control" Dialog, showing all the files in this project which aren't currently under Source Control.
- Select all the files you wish to now include under Source Control
- Press Next, then Finish
Now Check In your Solution again, and your POCO's should now be included.
First open the Team Explorer window:
- Team Explorer
Then expand your project and double click "Source Control".
In the Source Control Explorer window, browse to the folder that the POCO files should be located in, right click the explorer window or directory and select "Add Items to Folder" (or something similar... it's been a few months since I've used TFS)
Finally select the files that were auto generated and include them. Don't forget to check in!
Something to note, when including auto generated files into TFS it is possible to have issues in the future if you ever try to re-generate those files. You may end up with ReadOnly access issues. This can be solved by manually checking out the files to unlock them. Once checked out, re-generate to your heart's content!
This is a little late, but I just ran into the same problem.
I could not add the missing files to TFS. Instead of trying to add each file, I was able to right click on the EDMX file in the Solution Explorer then click 'run custom tool', then right click the EDMX file again and click Add To Source Control. This added all the missing files and I was able to check them in.
It turns out this was a bug with Visual Studio 2012 and the model being in a sub folder. Updated to SP1 and the problem when away.