45

I have used Entity Framework in Visual Studio 2012. Build entity model by "reverse engineer code first".

But when I setup Visual Studio 2015 just now, and setup EF power tools by NuGet, I can not find "reverse engineer code first" option.

Anyone knows what i should do?

Thanks!

ocuenca
  • 38,548
  • 11
  • 89
  • 102
Mike
  • 565
  • 1
  • 4
  • 5

8 Answers8

76

Entity Framework Power Tools is a Visual Studio extension, so you need to install it first. But, there is a problem, the supported versions of Visual Studio are 2010, 2012 and 2013. Visual Studio 2015 is in Preview Version. I think that's why it is not included yet. But I have a solution that works for me in case like this.

  1. Download Entity Framework Power Tools
  2. The .vsix file is a zip, so you can unzip it using Winrar (or any other program with this functions). Unzip only the file named extension.vsixmanifest
  3. In this file (it's a xml) you need to find a tag named SupportedProducts and add the Visual Studio 2015 version (go to Help->About Microsoft Visual Studio to check what edition you have installed) .

     <SupportedProducts>
       ...
       <VisualStudio Version="14.0">
         <Edition>Ultimate</Edition>
         <Edition>Community</Edition>
       </VisualStudio>
     </SupportedProducts>
    
  4. Overwrite the extension.vsixmanifest file in the .vsix, and try to install that.

Hope this help

Update 1

I tried with that configuration (Version:14.0 and Edition:Ultimate) and It worked.To save time, you can download it in this link. I also added the Community edition.

Update 2

Julie Lerman wrote an article in her blog about how to solve this issue as well.

Update 3

I strongly recommend to use EntityFramework Reverse POCO Generator when you are working with legacy databases. If your schema could change several times not using migrations, then is preferable to have t4 template which can help you to re-generate the model every time the DB is updated. The only you need to do is right click on your .tt file and execute Run Custom Tool option, that's all. EF Power Tools also has an option that allows you to customize the t4 template.

Community
  • 1
  • 1
ocuenca
  • 38,548
  • 11
  • 89
  • 102
  • i did as you said, but when i setup EFPowerTools again, error message "this extension is already installed to all applicable products", then i uninstall all the things about Entity Framework, include EFPowerTools, but it still shown "this extension is already installed to all applicable products", what can I do? – Mike Jan 18 '15 at 04:02
  • Let me try that myself. I don't have installed VS 2015 Preview Edition yet. Wait the update of my answer tomorrow. – ocuenca Jan 18 '15 at 16:18
  • hello @Mike, I'm installing VS 2015 Preview right now. I saw two things that are necessary to change. VS 2015 version is 14.0 and the edition is Ultimate – ocuenca Jan 19 '15 at 20:50
  • so, what's that mean? the problem can be not reslove in vs 2015 preview? – Mike Jan 20 '15 at 18:52
  • 1
    yes it works, You can download the .vsix from my answer. I uploaded it to my dropbox account and I shared the link. Look the update – ocuenca Jan 20 '15 at 18:56
  • 1
    There is a reason why Power tools is not supported in VS 2015. But +1 for finding the solution – st35ly May 24 '15 at 01:59
  • Has anybody managed to get this to work correctly following the final release of VS2015? For us it seems to work and pregenerate the views but when we attempt to update the database it errors saying the model has changed. – MrEdmundo Aug 17 '15 at 09:48
  • Yes, this is awesome! But, is it legal to use in a community (free) edition? Did it install in free versions of VS before? – Brandon Nov 29 '15 at 03:52
  • Yes, you can use it on the community edition. Check my update 2, Julie Lerman who is an authority in EF, wrote an article proposing the same solution. – ocuenca Nov 29 '15 at 04:00
  • I downloaded your link and installed it but when I go to ADO.NET Data Model I only see SQL Server providers. How can I see SQLite providers when making my data model? – user441521 Jan 31 '16 at 14:28
  • 1
    I think that is a different question, but you should look some SQLite provider for EF like [this](https://system.data.sqlite.org/downloads/1.0.95.0/sqlite-netFx451-setup-bundle-x64-2013-1.0.96.0.exe). You'll find all the info and resources that you need in this [link](http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki) – ocuenca Jan 31 '16 at 14:33
  • This works. I tried it on community edition in 2015. – Mostafa Feb 11 '16 at 21:22
  • Not working in VS 2015 Update 2. See http://stackoverflow.com/questions/36421344/visual-studio-2015-update-2-breaks-ef-reverse-code-engineer-vsix – Gene R Apr 20 '16 at 12:55
  • Interesting, I will take a look later, thanks @GeneR – ocuenca Apr 20 '16 at 13:02
  • How do you "Overwrite the extension.vsixmanifest file in the .vsix"? – ADH Jul 26 '16 at 19:26
  • unzipping it and zipping it again. I think you can find some illustrations in the Julie Lerman's article – ocuenca Jul 26 '16 at 19:29
  • I am using Visual Studio 2015 Professional version 14.0.23107.0, What should the solution for that ? – Sunny_Sid Jul 27 '16 at 07:21
  • Should your project be using an external connection string file (https://msdn.microsoft.com/en-us/library/ms254494(v=vs.110).aspx) you can expect to receive the error message "Unable to open configSource file". This is a bug in the extension which does not move the file in to the temporary work space. You can you can correct the error by manually coping your external connection string file in to %SystemDrive%\Users\\AppData\Local\Temp. – Terence Golla Sep 30 '16 at 19:53
  • I tested on VS Enterprise 2015 Version 14.0.24720.00 Update 1 and it works very well. Thanks man – Darós May 19 '17 at 13:14
  • The solution above works for version 0.9.0.0, but the link to Beta 4 was updated in 2017 to version 0.9.1.0 / Beta 5 and the *.vsix will install in VS2015 without issue. – LoJo Jan 31 '18 at 01:16
15

Now that VS 2015 is released, you will want to use EntityFramework Reverse POCO Generator https://visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838. ALthough the instructions are a little involved, the tweaks/workarounds mentioned above are no longer needed, and it works great.

ckapilla
  • 1,148
  • 13
  • 25
  • 1
    this should be the proper answer – Clay Smith Sep 02 '15 at 04:03
  • 3
    The power tools do more than reverse engineer your model from an existing DB - it can generate you a "view" class to reduce cold start up query times. Its not only a POCO generation tool. There is value in installing the tool as indicated by editing the manifest as suggested by @octavioccl – Ian Robertson May 17 '16 at 15:33
4

I've updated the EF Power Tools to work for Visual Studio 2017 and I've made it availble to be downloded from my DropBox if anyone is interested:

EFPowerTools.vsix

EdsonF
  • 2,719
  • 3
  • 30
  • 34
  • Shows a popup while installing saying "installation may cause the visual studio unstable.." – Linoy May 28 '18 at 09:19
  • It works perfectly on my dev machines, but don't install it if you're not comfortable with that message, would be my suggestion :-) – EdsonF May 29 '18 at 09:43
3

Just use the edm wizard, and use "code first from database", or if you do not like the attribute based code, use ef reverse poco template

ErikEJ
  • 40,951
  • 5
  • 75
  • 115
2

It even works with the community edition by setting Community.

Andy
  • 75
  • 5
0

The problem you might see soon is that even EF power tools get installed in VS 2015 community edition, you probably use EF7, which has different way how to set a primary keys/configurations in general in entities. You might get POCO objects but with wrong namespaces (EF 6 usage) and overriding

protected override void OnModelCreating(ModelBuilder modelBuilder)

in your dbcontext for relation handling instead of original

class EntityNameMap : EntityTypeConfiguration<EntityName>

configuration file coming from EF6.

st35ly
  • 1,215
  • 18
  • 24
0

step 1- download Entity Framework Power Tools from https://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d.

step 2- change download file extension from .vsix to .zip.

step 3- Extract .zip and open extension.vsixmanifest(xml file) and add following under supported tags and save.

<VisualStudio Version="14.0">
    <Edition>Pro</Edition>
  </VisualStudio>

Note:- doesn't matter you have any other edition.

step 4- now Select the files in the extracted folder and zip them. Don’t zip the folder.

step 5- now change the folder name and extension (example as EFPowerTools15.vsix).

Step 6- you should try to install created tool only from Administrator account. otherwise you still won't be able to install it.

Ravi Anand
  • 5,106
  • 9
  • 47
  • 77
0

You can simply follow this 2 step-

  1. Download the file from here.

  2. Follow this video tutorial (please run code snippet to see the tutorial) -

<iframe width="100%" height="300" src="https://www.youtube.com/embed/yQN2Iuqb8kw" frameborder="0" allowfullscreen></iframe>

Re-

More can be found here (written tutorial).


If any problem of viewing the tutorial, please follow this link for tutorial.

I think, this is enough for installing and it will solve your problem :)

Abrar Jahin
  • 13,970
  • 24
  • 112
  • 161