MVC 3 & ASP.Net with Entity Framework scaffolding error : No model classes are available - entity-framework

I am trying to use MVC3 with the Entity framework with Code First, but the code Template generation process in MS Visual Web Developer 2010 - is not detecting my Model in the models folder - giving a message - "No Model classes are available" - although I do have model classes for which I want to create controllers.
The templating option I've selected is "Controller with read/write actions and views using the Entity Framework".
I've uninstalled and reinstalled Web Developer 2010, but still having the same error.
Anyone know how I can get around this error?

xixonia's response worked for me. All I needed to do was build/rebuild the project and then everything worked as expected.

Rebuild all did not fix this issue for me... until I closed Studio, reopened and rebuilt all. Then it worked like a charm.

After create models must be build your project.
http://www.asp.net/mvc/tutorials/hands-on-labs/aspnet-mvc-4-entity-framework-scaffolding-and-migrations

I had this same issue and for me I had to go to the properties of the entity model in the entity model designer and change Code Generation Strategy to Default. It had been set to None because I had experimented with a DbContext generator.

I had this same issue.
While digging through my references, just before throwing the computer against the wall, I found that I had EntityFramework version 4.1 installed in the web project (by VS 2010 when the MVC 3 project was created).
I had 4.3.1 installed in the domain project (from nuget).
I uninstalled both of them and reinstalled from nuget.
Now everything is working again.
Hope this helps.

If you still have this problem then follow these steps to fix the problem:
1. Right click on your project and select [Manage NuGet Packages]
2. On the opened popup window, on the left hand pane, select Updates
3. On the right hand pane, at the very top right click on the Update All
During this process, it will ask you whether you want to overwrite the existing references (not sure about the exact phrase). So, say "Yes" to overwrite...
Now try to add the controller to your project and everything will be fine.
Good Luck!

Related

Update model from database not updating metadata

My project has stopped updating the metadata when I add new tables or stored procedures. Its on Visual Studio 2017. with .net framework 4.6.1
I use the Update model from database wizard and after selecting the new item and clicking finish. If I check in the model browser i can see the new classes in the Model and in the model.store. Also, Its in the solution explorer .edmx.
The problem is not all projects can reference the new items and i noticed the new items are not in the Entities Metadata.
Things i tried
Run custom tools on .tt files
clean all projects individually and rebuilt
closed application and open it
Please help
I have the entity framework (DB) in a separate project the is linked in the references. I found the only thing that worked for me was to unlink the reference, rebuild and have it fail and re link the project. SOOOO frustrating as this functionality used to work quite well.

Project looking for own DLL in another project

I'm currently trying to move a solution with multiple projects from VS 2015 to VS 2019.It consists of one application and a couple of class libraries, target framework for each is .net 4.5.1. I have made a local copy of the solution to do this.
Most of the projects compile without a problem, but some of the one that are used as AddIns for the application don't.
When trying to build, doesn't matter if the projects by themselves or the whole solution, it fails because it's looking for itself. In my example picture, the project ZZ_WPF_Bank_AddIn is, while trying to build, is looking for the ZZ_WPF_Bank_AddIn in the bin folder of another project in the solution.
I tried just copying the dll from the original project, to see what happens, but it just points to the same dll missing in another project.
Has someone encountered this behaviour before? I tried googling it, but couldn't find anything useful.enter image description here
For anyone who might stumble upon this:
The solution to my problem was removing all references to projects inside the solution and adding them via Browse, noch via the projects tab on the left side. For some reason the bindings were not working properly after the migration.

Data sources toolbox for VS2012 does not display my entity model

After adding an entity model either from the datasources toolbox itself or by adding it => "add" => "new item" it does not show up in the datasources toolbox and therefor i dont get that easy drop and drag functionality.
If I add a dataset it works but that is an older technology (is it not?) everything in my current project are entity models and to change to datasets (which only works if I add xmlns:yourAlias="clr-namespace:WpfApplication3") would be .. I don't think best practice and a waste of time.
I have recreated this same process of adding a entity model in VS 2010 and it works 100%, where i have the ability to simply drop and drag from the dataSource toolbox
Maybe ill just wait for VS SP1 before working with it for client projects. :(
//Edit
If I add the ADO.net Entity model in VS2010 and then load the project in 2012 it loads fine in the dataSource toolbox. This is an answer but not an ideal work around.
While working on a project I recently faced the same problem. It took me about two days of extensive research but I think I've finally found it:
http://msdn.microsoft.com/en-us/data/jj556581
At least for me it solved the problem. Please let me know if it helped you..
Being addicted to L2S, I tried to get familiar with VS2012 and EF5. But I nearly lost my nerves trying to use the data sources toolbox.
Finally I found a solution:
using Object Data Source is now the recommended approach for using EF in databinding scenarios. See this article for more details - http://msdn.microsoft.com/en-us/data/jj574514. The article also includes a link to revert to the old code generation if that is what you desire.

Problem creating a new framework project in Zend Studio

I have a problem when creating a New Framework project in Zend Studio. I'm new to Zend Studio, using Zend Studio ver.7.1.0.
When creating a new Zend framework project (Zend Server is successfully installed), it will not create the 'application' or 'public' folders.
In my previous test project these were created automatically. But here the only things being created are
Javascript Resources
PHP Include Path
PHP Language Library
Can anyone help me?
I had exact the same problem !
The answer is simple .
It's because of windows 7 permissions.
Just go to your localhost folder, It's
C:\Program Files (x86)\Zend\Apache2\htdocs
since you are using Zend server.
Right click on it and select "WRITE" permission for users.
Just to make sure I selected all permissions for all categories.
And next time I've created my Zend framework project,it created the structure as well !
Make shure the option Zend Framework default project structure is activated under project layout. You can check out Full featured Zend Framework and Dojo Project as well, but that may generate a little too much.
Try to use one of the existing basic projects and then remove the small amount of stuff that you don't need. See if that works for you.
Note you could also try zf tool and do "zf create project"
I know this is a few years ago, but I thought I'd give an answer as to how I solved this exact same problem. I'm only posting this answer here since a search for this problem turned up near the top of the google results, so I'm not posting for some useless SO points.
In the past, I would create ZF projects in Zend Studio and it would create for me a basic application structure with public, application, library, etc. folders. One day I accidentally deleted ZFDoctrine which I had in my Zend Framework path. Weeks later, when I went to create a new ZF project, Zend Studio created the new project without the familiar basic application structure. I did not get any error or warning so I tried to create the same project using zf Zend tool. At the command line, I received several warnings that ZFDoctrine would not load. So I put ZFDoctrine back in my library path and the problem disappeared. So long story short, it's probably something in the library path.

Areas over multiple projects - Views not found in child projects

I've been following this guide from MSDN about "Creating an ASP.NET MVC Areas Application Using Multiple Projects". Since ASP.NET MVC 2.0 is just preview one would imagine there to be some bugs.
My problem is, it simply doesn't work! At least not the way it's suppose to. After setting everything up and pressing F5, one would think that, this will work, neat! BEEEP. Wrong.
It doesn't find the Views in the child project! Because in my case it tries to search within ~/Views which of course is in the parent!
When debugging i see that it Does run the Controller inside my child project, but when using return View(); on that Action, it looks inside the Parent View-folders.
I ask, Bug or Feature?
Tried this in both Vs2009, Vs2010 with both Framework 3.5 and 4.0.
I put "multi project areas" in Google and came accross this post: http://forums.asp.net/p/1494640/3540105.aspx. Note specifically Phil Haack's response.
It appears that defining your views in the parent project is "functioning as designed" because of this entry in the MSDN post: Now that all the code is in place, the final step is to customize the build process for each area project. This customization causes some child-area files, such as the views, to be copied to the main project before the application is built.
The "problem" with the post is that it was defined for the beta where this build step was easily accessable. RC+ you have to point to the Futures assembly and assign the build step slightly differently if this is the path you choose.
If you don't like the direction this pushes you, the portable areas portion of MvcContrib Phil mentions is about as good as you're gonna get to an alternative.
I went through the same pain as you. This is what I did.
Made sure I was running MVC 2 RC (uninstall beta 2, install the RC).
Recreated the project from scratch.
No need to edit the csproj files, no need to create a routes.cs, and no need to edit global.ascx.cs, just right click the main project to get the context menu. From the Add menu item you can create a new area.
The views have to be in the main
project or you can use the
information in this post
http://forums.asp.net/p/1494640/3540105.aspx, which I plan on doing so the views are in each area.
It doesn't support the Multi-Project areas, but for now that's ok with me. The link above does point you in the direction for multi-project areas.