March 2020: In comments below, someone asked about VS2019.
The EF Power Tools Community Edition (see July 2017 note below) still works for VS2019.
Erik EJ also created EF Core Power Tools.
While I’m at it, I thought I would also point out the plain old EF Tools for VS2019. For VS2019 (& IIRC for VS2017), these tools are installed via the Visual Studio Installer.
Entity Framework tools are installed as part of the Data storage and processing workload in the Visual Studio Installer.
You can also install them as an individual component under the SDKs, libraries, and frameworks category.
July 2017: something amazing happened! Erik Ejlskov Jensen, the creator of the SQLCe provider Entity Frameworkas well as the creator of the very popular SQL Server Compact Toolbox extension for Visual Studio, has given us a community version of EF Power Tools for VS2015 and VS2017. Thanks to the tools already being on GitHub, he forked the tools and now we have
EF6 Power Tools Community Edition that you can get via Visual Studio Extensions
Oct 2016 note: There have been over 60,000 hits to this blog post so far. My host is reaping the benefits ($$$). In July, I submitted a pull request to update the VSIX. The PR was finally merged. Now just waiting for the change to show up in the VS Gallery.
TLDR: If you don’t want to do the tasks (even though they are so easy) you can download the updated VSIX I created from here.
The Entity Framework Power Tools extension for Visual Studio has been around for quite some time and is still called a Beta. I cannot live without it’s “View Entity Data Model (Read-Only)” feature which I used to validate my code first models.
But if you try to install the extension into Visual Studio 2015, you won’t find it.
Checking the extension in Visual Studio Gallery, you’ll see that it hasn’t been updated to install into VS2015.
The fix is nothing more than making it know about VS2015. There are no other compatibility problems that I have experienced. Modifying an extensions installation package (which is just a zip file!) to be aware of another version of Visual Studio is pretty easy. Here are the steps to get the EF Power Tools into VS2015.
Download the extension from the Visual Studio Gallery page.
Find the file
and change it’s extension to zip.
Extract the files from the zip file.
Open the extension.vsixmanifest file in a text editor and find the Supported Products section.
And copy paste one of the Visual studio elements, changing the version to 14.0. I have the Enterprise version but didn’t bother changing it from Pro here and it didn’t seem to be a problem.
Now you have to reverse your steps in order to recreate the VSIX file.
Select the files in the extracted folder and zip them. Don’t zip the folder. The files have to be at the root. (Guess how I learned that! ) I named my zip file VSPowerTools15.zip
Rename the file to have the vsix extension.
Run the file right from here.
Voila!
If Visual Studio was open, you’ll have to restart to get this to kick in.
Also you’ll see Entity Framework Power Tools listed in the installed extensions when you look at the About section of Visual Studio 2015.
I accidentally mistook this for something it was NOT and (embarrassingly) tweeted it. I had forgotten that I had done this for the VS2015 preview. Then I installed VS2015 RTM on top of the preview and that picked up all of the installed extensions. When I saw the power tools listed in About, I thought they had a) finally gotten rid of the “Beta” tag and b) installed automatically with VS2015. When I realized the extension was installed, I uninstalled that and indeed the tool went away. So for anyone who saw that tweet…. sorry! Guilty as charged …
Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!
Thanks for this, I’ve been looking for a way to get this into 2015 since I installed it. Great help.
Could someone expand on why this was discontinued in development?
I wish I knew. There have been over 60,000 hits to this blog post and my hosting bill is stupidly high every month because of it. 🙂
You should send an invoice to the EF team :-)! Thanks for this article though, it’s a very useful tool and it learned me how VSIX packages work 😉
haha …yes . My WPEngine hosting bill was pretty crazy for the last year because of this post! 🙂
For some reason, it doesn’t work for me… I’m running VS2015 Community. I tried changing the manifest version to Community but no luck.
Running it from command prompt as admin did the trick 🙂
Hello Dushko, check my answer in this on Stack Overflow
THANK YOU SİR
after following above blog, you should try to install created tool only from Administrator account.
You don’t change to community. Just use Pro as shown in the image instructions
Thanks for sharing, this hack saved my day.
I was able to install the power tools and when I right click on the context class and select View Entity Data Model (read only) from the Entity Framework menu VS hangs and the designer never appears. Any ideas?
Dan,
Any chance you have VS2015 Community Edition?
Pro edition. I had to run VS as admin to make it work.
Is it illegal to use power tools in VS 2015 Community Edition?
nope 🙂
haha, I’m here because I’m watching your “Getting Started with Entity Framework 6” 😀
Bless you for this – it saved my life!
I Installed the power tools beta 4 on vs2013 but and follow the videos of pluralsight but when i tryed to view the model , i got the following error
System.IO.FileNotFoundException: Could not find file ‘C:\EF6\NinjaDomain.Classes\NinjaDomain.Classes\App.config’.
File name: ‘C:\EF6\NinjaDomain.Classes\NinjaDomain.Classes\App.config’
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.FinishInitUriString()
at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver)
at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
at Microsoft.DbContextPackage.DbContextPackage.GetUserConfig(Project project, String assemblyFullName)
at Microsoft.DbContextPackage.DbContextPackage.DiscoverUserContextType(Type& systemContextType)
Sorry for taking a little bit away of the topic, but I could not find any info about EF6 Tools. What is the difference between “EF 6 Tools” (separate WIN installation) and “EF Power Tools” (as extension for VS)?
EF Tools is the designer itself. It used to be built directly in to Visual Studio. It will be installed as part of the VS2013 and VS2015 installations though but it is up to you to install updates. The power tools are some extras.
Many Thanks, its really simple but brilliant
Hello, Julie!
Thanks for great VSIX package!
I just wanted to share my little issue and the solution.
Everything worked great until upgrade MySQL package. Then nasty “Exception has been thrown by the target of an invocation” error message started to appear.
After debugging the PowerTools (VS with VS) I’ve figured out the problem. My solution is add binding redirection into C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe.config file as follow:
———————————–
———————————————-
Put your MySql.Data.dll version instead of “6.9.7.0”
Thanx again!
You are a gem! I would have been crying if it wast for this line:
“Select the files in the extracted folder and zip them. Don’t zip the folder. The files have to be at the root. (Guess how I learned that! Smile )”
Hey Julie,
This saved me some time…Thanks for posting:)
Thank you for posting this. Very helpful, making my work a little easier.
And *that* is why Julie Lerman is my favorite guru!
Fantastic!!! Thanks a lot mate!
Thanks for your valuable help.
Excellent! Just installed it into VS2015 Community. Works fine.
Thanks, great help as always. Good lesson in Windows 10 on how to do simple tasks 🙂
Thanks! Used it for Community!
Hello,
Has anyone had power tools working with Visual Studio 2015 and Entity Framework 7 (core) ? I have installed power tools successfully with this post instructions but keep getting this error when trying to access the read only model from power tools.
Here’s the error:
“a constructible type deriving from DbContext could not be found in selected file.”
EF7 is totally different set of APIs from EF6 so the power tools will not work with it. It’s killing me not to be able to validate my models visually yet with EF7 but the team has too much on their plate ATM to even look at that problem. I do know that they have toyed at some point with a way to visualize the models and it is something that they will give us at some point. Maybe someone else is working on a tool as well.
Thank you for the direct reply!
Visualising the model seems to be under the high priority features:
https://github.com/aspnet/EntityFramework/wiki/Roadmap
🙂
Will this work in visual studio 2019
Hi Clinton, I just realized I haven’t gotten notifications in a long time on comments. Sorry. VS2019 is different and I’ve just added a small update at the top of this post! HTH sorry for the delayed reply
thank you 😀
THANKS a lot..
This post is perfect,thanks, great help as always. 🙂
Thanks for sharing! It was very helpful for ours!
Thanks a lot..Excellent!!
Thanks, worked well. 🙂
Thanks! And thanks for Pluralsight videos!
This app from microsoft do the same and you don’t need to do anything. Works with VS2015 like a charm! https://visualstudiogallery.msdn.microsoft.com/ce89299b-d337-4b77-a27b-d939991b8ff0?SRC=Featured
except it’s a paid product and a completely different designer. Why shouldn’t we be able to use the Microsoft tool when it’s literally a matter of a tiny edit to the vsix?
Very useful! Sorted it within minutes after reading your article. Many Thanks!
This rules. Thanks very much.
Thanks for a good article. I have done everything and i got Installation Complete Window even, but there is no Entity Framework in context menu. My VS 2014 Pro, i restarted vs and comp, no way. Help please!
Why is my comment beeing deleted?
not deleted…something about it required approving it ..which I have done now.
But I don’t happen to know what to say to answer your question. Maybe someone else will come along with an answer.
Ok, thanks. I hope you understand what i have written before, because my english is not the best.
I installed it on Visual Studio 20015 Enterprise, the EntityFramework menu is there, when I click reverse engineer…the connection window comes up and I select the table, but when I click ok after some seconds it is closed without any error and no code is generated!
any suggestions?
First, keep in mind that there is an improved way to reverse engineer as part of the EF Designer for VS2015 so that you don’t need the power tools for reverse engineer. I use the power tools for the visualization only. There are known issues with the reverse engineer in with VS2015 Update 2. Look for comments around May 2016 on the VS Gallery page for how people have fixed this. (https://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d)
Thanks!!!
Bless you Julie!
And now I too own the T-Shirt for not zipping up the contents inside the folder…I need to slow down and READ. Thanks Julie!
oh I’m guilty of doing that all the time…skimming and missing important stuff! 🙂 Glad this helped.
I’m having trouble extracting the files from the zip folder. Once I open the zip folder, the original vsix just appears. Help plz
Thank you!
Thank you very much.
This post is great.
You’ve helped me much.
I LOVE U!
tks tks tks !!! ;D
You know what..??? You are a super hero…
Worked! Nice!
Julie, you’re the one!
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.
After I’ve done this, I try to open visual studio and I get the error: The Application cannot start.
I have tried repairing and I did uninstall and install Visual Studio 2015.
Did any one get this?
Config:
Windows 8 Enterprise
Visual Studio 2015 with all updates up to date
oh no! I’m so sorry to read this. This post has been viewed almost 60,000 times since I published it and this is the very first time I’ve ever heard of it happening. Did you do the manual editing or download the vsix I created? The link to the VSIX has been clicked over 5600 times. So either way, I think a LOT of people have followed this info and I’ve not gotten a single report of this. I sure hope that by the time you read this the problem is fixed. 🙁
Works like a charm!
You are the MVP
I am having a bit of an issue running the tools. No problem with the installation but when I run any of the tools I get “Unable to open configSource file ‘bin\ConfigSourceFileName’ . If I run the tools against a derived DbContext in a project that is not using a configSource file, the tolls work as expected.
Hi John,
(NYC watershed! Back in the days when I lived in the hudson valley, I’ve spent lots of time around the various watershed spots!)
Typically this means that you just need to ensure that a project that has the appropriate config file is marked as the startup project. See if this blog post helps: http://thedatafarm.com/data-access/entity-framework-power-tool-tips-to-view-model-a-feature-i-depend-on/
julie
Thanks for the quick response Julie. I’m glad you have fond memories of the watershed. We work hard to keep the water clean! I went through the document you linked (that would have been a good thing to do before my post, yes?). Anyway, I set up a DesignTimeHelper project, put a valid connection string in app.config, dumped a table to the console for a sanity check and I’m still having an issue with the Tool. I am now getting a good old “Object reference not set to an instance of an object” . Any direction to point me in would by much appreciated. Thanks so much for your time! john
Hmm I can’t really tell without looking at it. I can only recommend googling some more? Also, check to see if anyone is reporting that error on the page(s) for the tool on VS Gallery (https://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d)
Very helpful. Thank you for taking the time to write this.
Bro thanks for a little hack 😉
For some reason, it doesn’t work for me… I’m running VS2015 Professional.
After select db, i receive this error:
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG).
Did you get working? I am having the same issue. For me it is working some month ago and know it is not working any more.
getying this error, any one knows ?
One or more errors occurred while processing template ‘Entity.tt’.
error : An exception was thrown while trying to compile the transformation code. The following Exception was thrown:
System.ArgumentException: Empty path name is not legal.
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.IO.File.OpenRead(String path)
at Roslyn.Utilities.FileUtilities.OpenFileStream(String path)
at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path, MetadataReferenceProperties properties, DocumentationProvider documentation)
at Microsoft.VisualStudio.TextTemplating.CompilerBridge.c.b__15_0(String x)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Linq.Enumerable.d__66`1.MoveNext()
at System.Linq.Enumerable.d__66`1.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
at Microsoft.CodeAnalysis.ImmutableArrayExtensions.AsImmutableOrEmpty[T](IEnumerable`1 items)
at Microsoft.CodeAnalysis.Compilation.ValidateReferences[T](IEnumerable`1 references)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.WithReferences(IEnumerable`1 references)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CommonWithReferences(IEnumerable`1 newReferences)
at Microsoft.VisualStudio.TextTemplating.CompilerBridge.PrepareNewCompilation()
at Microsoft.VisualStudio.TextTemplating.CompilerBridge.Compile()
at Microsoft.VisualStudio.TextTemplating.TransformationRunner.Compile(String source, String inputFile, IEnumerable`1 references, Boolean debug, SupportedLanguage language, String compilerOptions)
One or more errors occurred while processing template ‘Entity.tt’.
error : An exception was thrown while trying to compile the transformation code. The following Exception was thrown:
System.ArgumentException: Empty path name is not legal.
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.IO.File.OpenRead(String path)
at Roslyn.Utilities.FileUtilities.OpenFileStream(String path)
at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path, MetadataReferenceProperties properties, DocumentationProvider documentation)
at Microsoft.VisualStudio.TextTemplating.CompilerBridge.c.b__15_0(String x)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Linq.Enumerable.d__66`1.MoveNext()
at System.Linq.Enumerable.d__66`1.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
at Microsoft.CodeAnalysis.ImmutableArrayExtensions.AsImmutableOrEmpty[T](IEnumerable`1 items)
at Microsoft.CodeAnalysis.Compilation.ValidateReferences[T](IEnumerable`1 references)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.WithReferences(IEnumerable`1 references)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CommonWithReferences(IEnumerable`1 newReferences)
at Microsoft.VisualStudio.TextTemplating.CompilerBridge.PrepareNewCompilation()
at Microsoft.VisualStudio.TextTemplating.CompilerBridge.Compile()
at Microsoft.VisualStudio.TextTemplating.TransformationRunner.Compile(String source, String inputFile, IEnumerable`1 references, Boolean debug, SupportedLanguage language, String compilerOptions)
thanks a million for these instructions.
Also, love you courses on pluralsight
Hi Julie, have you been able to get “View Entity Data Model (Read-only)” working with EF Core? I’ve been trying for some time, and I’m finding there seems to be no documentation for it.
Every time I try it says: “A constructible type deriving from DbContext could not be found in the selected file.” I am using an extension class, but when commenting that out I still get the same result.
Hi JP, unfortunately the tooling does not support EF Core. But watch this space as Brice Lambson from the EF team works on it! https://github.com/bricelam/EntityFramework.VisualStudio/issues/2
Excelente! Obrigado!
Fantastic – -thanks!
Anyone knows if EFPowerTools is compatible with VS2017 ?
For we use the extension (PreGenerating Views) works like a charm.
Toinstall in VS2017 add a new product entry with: Version=”15.0″
When installing, ignore the warning of incompatible extension and install.
thank you!
Thanks Fernando!
I was a little worried about the warning, but after seeing your comment I went ahead. Up & running now 🙂
Hi Julie,
Good Evening. I started EF6 and found this very helpful.. Thanks.
I’m getting this error in VS2017: System.ArgumentException: Empty path name is not legal. Any suggestions?
Also, if everyone seems to like this, then why isn’t being updated by Microsoft?
David McCarter
For some reason when I want it to create a read-only model, it errors on me.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.MissingMethodException: Method not found: ‘System.Collections.Generic.ICollection`1 Business.Entities.Domain.get_Entities()’.
at API.AuthContext.OnModelCreating(DbModelBuilder modelBuilder)
at System.Data.Entity.Internal.LazyInternalContext.CreateModelBuilder()
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.LazyInternalContext.get_ModelBeingInitialized()
at System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter writer)
I have a Many to Many relationship defined in fluentApi for domains and Entities. Updating the database works properly, just generating the model fails.
@Chad-
at the top of this blog post, there’s a link to another post (link says “tool I cannot live without”) and the post is filled with troubleshooting tips for the EDMX viewer of the power tools. I have not done any trials with VS2017, FWIW.
Julie
Don’t work for visual studio 2015 pro
I tried this on VS2017, only thing I have to do is use version as 15 and it worked for community version, thanks a lot.
Thanks 🙂
Thank You! Been battling this for a while now.
Thank you very much!
Sorry to keep this thread going but it seems to be the only active place on the internet where the issues with EF Power Tools are being discussed.
I’m running VS 2015 and have a project with .NET 4.5.1 and was able to install the extension. If I run it with this version of .NET i get the error about Entity.tt, if I switch to 4.5.2 I get System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
There’s 16GB of memory on the laptop so it’s definitely not a memory allocation issue. Anyone have this problem and been able to sort it out
I just downloaded it and there is no longer a SupportedProducts section in the extension.vsixmanifest file:
https://blogs.msdn.microsoft.com/visualstudio/2013/08/08/update-for-extension-authors-vsix-manifest-version-range-attribute/
I tried to change the following for VS 2015:
and got the following error:
Microsoft.VisualStudio.ExtensionManager.InvalidExtensionPackageException: The file is not a valid VSIX package. —> System.IO.FileFormatException: File contains corrupted data.
Can anyone help?
Check the note at the top of the page. The community edition works with VS2015 and VS2017. No need to muck about with the vsix any more.