How to add EntityObject Generator in Visual Studio 2015? - c#

I have installed the latest Entity Framework version (EntityFramework.6.1.3) in VS2015. I have added the EF in the project and deleted the 2 .tt files (edmx_file_name.tt and edmx_file_name.Context.tt) as they were from the DBContext.
Now I am trying to add the EF 6.x code generation template by open the model in the EF Designer, right-click on the design surface and select Add Code Generation Item.
To add the Code Generation in ObjectContext i need to install the EF 6.x EntityObject Generator. I downloaded it from here.
But it I couldn't install it in VS 2015.
How do I solve this?

Well, for all those poor souls like me that no longer have VS2013 installed, there's much easier option. You can just install the EF 6.x EntityObject Generator for C# for VS2015.
Sure, the VSIX will shout at you that it's not meant for 2015. Just ignore it :)
The fact that it is not supported or advertised as "compatible with VS2015" does not imply that it does not work. It's a pack of T4 templates. Their syntax or features have not changed much since then.
Download the VSIX from marketplace, save it somewhere, unzip it (that's just a ZIP archive) and then edit file called: extension.vsixmanifest. Inside you will find such block:
<SupportedProducts>
<VisualStudio Version="10.0">
<Edition>VCSExpress</Edition>
<Edition>VWDExpress</Edition>
<Edition>Pro</Edition>
</VisualStudio>
<VisualStudio Version="11.0">
<Edition>VCSExpress</Edition>
<Edition>VWDExpress</Edition>
<Edition>Pro</Edition>
</VisualStudio>
<VisualStudio Version="12.0">
<Edition>VCSExpress</Edition>
<Edition>VWDExpress</Edition>
<Edition>Pro</Edition>
</VisualStudio>
</SupportedProducts>
Copy, paste, add a block for Version="13.0", and maybe futher too (14.0=VS2017?), save, ZIP it back, change extension to .vsix and try to install.
Worked for me on VS2015, installed with no problems, added EntityObject T4 templates, and generated code from EDMX as it was supposed to.

Since until now, no EntityObject Generator Template is supported in Visual Studio 2015, the alter solution is, open your solution with Visual Studio 2013, then open your edmx diagram, right click, select "Add Code generation Item", you will see "EF 6.X EntityObject Generator", if you cannot see it, go to "online" menu, and you will see "EF 6.x EntityObject Generator For C#" display. Select the EntityObject Generator and click "Add" button to add it to you data access layer project. The tt will auto generate EntityObject classes for you. Save the project, exit visual studio 2013. Reopen the solution with visual studio 2015. Done.

Related

Where are Entity Framework Tools in EF6 and Visual Studio 2017?

I'm using Visual Studio 2017 and Entity Framework 6, and for the life of me, I cannot find the EDMX file, Entity Data Tools, Model Browser, or Entity Designer...
Am I losing my mind here? I've created multiple new projects trying to find these UI-based tools for working with the Entity Framework data models and can't seem to get anywhere.
Please help!
I believe I have the correct tools installed in the VS2017 Install:
For anyone looking at this, in my case the answer was that I was using a Code-First implementation of the Entity Framework, which apparently does NOT give you access to the Visual Tools.
So there is no EDMX file in Code-First Entity Framework.
I had similar issue. I reinstalled Entity Framework 6 tools without luck, even reinstalled SQL tools (sorry, forgot exact name). But solution was very simple:
right-click the edmx file-> choose Open with->choose ADO.NET Entity
Data Model Designer
At the installation of VS2017 you had to go to Individual Components to install those tools, don't think they are installed by default.
Individual Components
SDK, Libraries and Components
You can run this install from the VS Installer
Entity Framework not appearing in Add New Item list in Visual Studio 2017
Please also see the current documentation. They state that for current Visual Studio versions, the tools will be included. For previous versions, separate installers (MSI packages, not extensions) are available for download at the Microsoft Download Center. F.e., see Visual Studio Releases > Visual Studio 2013, which will tell you where to find the MSI for Visual Studio 2013.
As in response to gotmike's accepted answer, today there's an 3rd party marketplace extension called Entity Framework Visual Editor, which can be used (I didn't try it myself) to generate a visual representation out of the code first model/POCO classes.
Also note that the Entity Framework Power Tools always had the feature to preview code first entities in a designer view called "View Entity Data Model (Read-only)". This option appears in your context menu when you select a model class derived from DbContext.

Downgrading solution from Visual Studio 2017 RC to Visual Studio 2015

I have had a project in VS 2015 Update 3 with a lot of code logic behind. I upgraded it to VS 2017 RC successfully. The code implementation went on and on until getting to the point where VS 2017 RC exhibited a lot of issues and instabilities e.g. .Net Core DLL template removed! by installer or Resource file could not be compiled and so forth! I'd like to revert the solution back to VS 2015 to keep working flawlessly but it's impossible easily due to a lot of code implemented in VS 2017 excluding new Roslyn features. Any suggestions how to perform the downgrade?
You will also need to update your *.vcxproj files, to change the toolset referenced there to the one used by the earlier compiler.
What I found useful, is to create a small scratch project (just simple console app) in each version of visual studio, then use beyond compare or similar to contrast the .sln and .vcxproj files from each vs version. This will show you the toolset changes and maybe a few others that you need. For example going from vs 2017 to vs 2019 the toolset changes from 141 to 142.
So the lines
<PlatformToolset>v141</PlatformToolset> are for vs2017
and
<PlatformToolset>v142</PlatformToolset> is for vs2019
It's indeed a manual process and no there are no tools that can automate that.
I had the same problem and i fixed it using this solution:
1) create a solution of whichever project you want (winforms, etc)
2) browse to your project folder and find your .sln file.
3) open it using notepad.
4) copy the first 4 lines as shown
here.
5) find your .sln file for the project you wish to downgrade. for example : foo.sln (its found where your project is).
6) open it with notepad and paste the lines instead of the first 4 lines
7) save and open the sln. it should open it under visual studio 2015
i hope this works for you

Bulid SQLite-Net Extensions in visual studio professional 2013 but not successful

I am new to windows app and I am going to build the sqlite-net extension project to .dll file in order to make the models have the relationship attribute of one-to-many, one-to-one, many-to-many.
Link: https://bitbucket.org/twincoders/sqlite-net-extensions
This is the info that it shows when I open the project in visual studio 2013.
Unsupported
This version of Visual Studio is unable to open the
following projects. The project types may not be installed or this
version of Visual Studio may not support them. For more information
on enabling these project types or otherwise migrating your assets,
please see the details in the "Migration Report" displayed after
clicking OK.
- IntegrationTests.Touch-MvvmCross, "C:\Users\**\Downloads\sqlite-net-extensions\sqlite-net-extensions\IntegrationTests.Touch\IntegrationTests.Touch-MvvmCross.csproj"
- IntegrationTests.Touch-PCL, "C:\Users\**\Downloads\sqlite-net-extensions\sqlite-net-extensions\IntegrationTests.Touch\IntegrationTests.Touch-PCL.csproj"
No changes required These projects can be opened in Visual Studio
2013, Visual Studio 2012, and Visual Studio 2010 SP1 without changing
them.
- Tests, "C:\Users\**\Downloads\sqlite-net-extensions\sqlite-net-extensions\Tests\Tests.csproj"
- MvvmCross, "MvvmCross"
- SQLiteNetExtensions-MvvmCross, "C:\Users\**\Downloads\sqlite-net-extensions\sqlite-net-extensions\SQLiteNetExtensions\SQLiteNetExtensions-MvvmCross.csproj"
- SQLiteNetExtensions-PCL, "C:\Users\**\Downloads\sqlite-net-extensions\sqlite-net-extensions\SQLiteNetExtensions\SQLiteNetExtensions-PCL.csproj"
- SQLiteNetExtensions, "C:\Users\**\Downloads\sqlite-net-extensions\sqlite-net-extensions\SQLiteNetExtensions.sln"
I try to build it and it shows some errors. So I right click the project and download the missing packages. When I try to build it again, it shows these errors:
Does anyone successfully bulid it to .dll file or anyone can fix the problems like these?
Many Thanks!
The Integration test projects are MonoTouch projects, that won't open in Visual Studio unless you have Xamarin Business license installed in your PC.
However, the SQLite-Net Extensions project is a standard PCL project and you will be able to compile it from Visual Studio without Xamarin. The problem that you are describing is probably related to not having the SQLite-Net dependency downloaded.
Make sure that you have NuGet Package Manager plugin installed and restore NuGet packages for the project to restore the dependencies and it should work.
You can also download the pre-compiled DLL from the Download page in the project page.
I solved it with changing the build platform. Thx guys!

MSM Merge Modules in Visual Studio 2013

Could someone please let me know where I might find resources for creating MSM files? While I am able to create MSI files using InstallShield, it seems that Visual Studio no longer supports Merge Module Projects, judging by the link below and the screenshot of my version of Visual Studio 2013 - http://msdn.microsoft.com/en-us/library/z6z02ts5(v=vs.80).aspx
To create a new merge module project:
On the File menu, point to Add, then click New Project.
In the resulting Add New Project dialog box, in the Project types pane, open the Other Project Types node and select Setup and Deployment Projects.
In the Templates pane, choose Merge Module Project.
For those still looking to use Merge Modules in Visual Studio; there is an official Microsoft extension for Visual Studio 2013 that lets you create Merge Module projects again.
Information on the extension, click here. The page leads to the Visual Studio Gallery where you can download the extension
Update 17 Sept 2015: an extension for VS2015 is also available here.
As discussed in the comments, Setup projects got removed from Visual Studio; a version of InstallShield was provided as their replacement. The standard alternative to InstallShield is WiX. WiX is somewhat arcane at first - it's a pretty thin layer over Windows Installer - but there are quite a few resources and examples out there.
Good resources for getting into WiX are http://wix.tramontana.co.hu/ and http://wixtoolset.org/documentation/manual/v3/. You can download the tooling from http://wixtoolset.org/

Requisites to read an edmx file in Visual Studio 2012

I've got an application in Visual Studio 2012 written in C# that generates code for a aspNet MVC application. I've generated the edmx file but when I try to open it, Visual Studio tells me that it was unable to display the file and asks if I want to open it with XML editor.
I also generated the appropriate "Context.cs" and "Designer.cs" files.
I manage to open other edmx files in a diagram visualization.
What I want to know is: what are the requisites to open it and see it in a diagram form? Are there support files I'm missing?
The EDMX file is not just XML representing the database structure / mapping but also how the Visual Studio designer should render the diagram (where to place tables, associations etc).
I found this project that creates EDMX files programatically (I have NO affiliation with this and found it through good ol' Google).
Has written here:
Entity Framework 5 uses versions 3.0 of CSDL, MSL, and SSDL specifications.
Each Visual Studio version has its own CSDL, MSL and SSDL specifications:
Visual Studio 2008 uses EDMX v1
Visual Studio 2010 uses EDMX v2
Visual Studio 2012 uses EDMX v3
Have a look at the section Changes in CSDL, MSL & SSDL 3.0 (EF5) from the link above to see what need to be changed in your EDMX generation process to be able to open it with VS2012.

Categories