I have an vs 2015, i am working on mvc application but when i tried to add area i cann't see add area option any where in those option, but i could able to add those in 2012 version. And also in case of adding controller to the project i can't add normal MVc controller to my project it's giving only option for adding Web api controller and and its types, how should i make this work ? sholud i install some scaffolder templates or what ? can i get the solution for this issue ?? , thanks in advance.
For VS 2019
Press right click on ur project
2. Add
3. New Scaffolded Item...
4. MVC 5 Area
Yes, I found the problem that it's my project issue. adn becuase it was a mvc4 project and i am trying to run in vs 2015, it couldn't able to recongnize as right version.
and Updating my project mvc version solved the problem
Ref 1.https://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253806
Ref 2.http://www.codingdefined.com/2015/04/how-to-fix-systemmethodaccessexception.html
Related
When I try to add new controller I'm not able to add, I'm getting error message like
Earlier I have added controller, view. It was working fine but suddenly not able to add controller and view. I'm having four project like model, DAL, Core, Service.
I'm using Visual Studio 2015 asp.net mvc 5.2.3.0 and .net frame work 4.6.1.
I also had the same issue long back, and i solved it by doing the following three steps:
As overall, We need to clear the ComponentModelCache, the cache will rebuild next time VS is launched.
Three Steps:
Step 1: Close Visual Studio
Step 2: Delete everything in this folder C:\Users\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache
Step 3: Restart Visual Studio
Note: 14.0 is for visual studio 2015. This will work for other versions also.
Hope this will helps , kindly let me know your thoughts or feedbacks
Thanks
Karthik
I am creating an MVC project in VS2017 and in VS2015, when you create an MVC templated ASP.NET Web App, it will automatically build an account controller for you which adds register and log in functionality. It will add an AccountController.cs and ManageController.cs to controllers with the appropriate views.
But in VS2017, when I create an MVC project it doesn't add this to the project. I've tried importing the files from an old VS2015 project, but It didn't seem to work. How can I get around this? Is there a way to create a project with the account controller or did they remove that in VS2017?
You need to select some form of authentication when you create the app.
My issue/resolution was slightly different than the accepted answer. I was choosing the "Web API" template while checking the "MVC" checkbox and I DID select Individual User Accounts, but the account controller/views were still not created. It appears the Account boilerplate doesn't get generated with the Web API option, regardless of what you choose for Authentication.
Had this problem myself today creating an ASP.NET Core Web Application with identity. changing the version from ASP.NET Core 2.1 to ASP.NET Core 2.0 fixed the problem.
I am using visual studio version 15.7.6, .NET Framework version 4.7.03056
You can easily execute this command in the nuget console and your problem will be solved:
Install-Package Microsoft.AspNet.Identity.Samples -Version 2.2.0-alpha1
I am following the Microsoft 'first-mvc-app' tutorial from here. When I try to add a controller class to the model folder, I can't add it. The add button is greyed out and doesn't give a reason for it. I followed the tutorial to the T so I think something is different with my setup. I am running Visual Studio 2015 with the latest updates and I am using MVC 1.0 RC2.
You need to Shift-F5 to end debug and it will not be greyed out.
Try filling the forms like "Model Class" by selecting from the dropdown lists instead of directly entering text. This activated the "Add" button in my case.
i'm install Visual Studio 2015 final release and create mvc6 beta5 project (by default template).
Trying add controller as in mvc 5.2 (also in vs2015 final release):
but, in mvc6 beta5 project this menu missing:
1. How solve the problem?
UPD
2. Is it possible add mvc6 controller with generate views?
Prior to MVC 6.0 the notion of an MVC Controller and a Web API Controller were somewhat different. To the untrained eye, they looked similar but they did behave differently and were using different classes.
Hence why when you clicked the Controller… option, you had the ability to choose between an MVC Controller and/or a Web API Controller.
As of MVC 6.0, both MVC and Web API controllers have now been unified. They are now exactly the same thing and are using the same classes.
So you don’t really have the need to choose between an MVC Controller and a Web API Controller.
Simply click the Add New Item which in turn will open the Add New Item dialog.
From the Add New Item dialog in the top right search textbox, enter Controller.
You’ll be able to select the MVC Controller Class template.
Who knows...maybe by the time they ship the final product, they’ll bring it back but at least for now, this shouldn’t be a show stopper.
EDIT:
For the scaffolding stuff, perhaps this link might help.
to solve this go to project.json
then add the following dependency:
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final"
then you should be able to right click controllers folder and see the new controller button appear
I am facing the same issue for visual studio 2015 community edition, followed following steps and restarted visual studio. It resolved my issue
1)Open VS2015=>TOOLS=>Customize.
2)Select Commands.
3)Select Context menu.
4)Select Project and Solution ContextMenus|Folder|Add.
5)Check that 'Controller' appears.
6)IMPORTANT -Move up Controller item to the top.
7)Restart visual studio
I just downloaded the new nopCommerce 3.2 MVC 4 application.
When I open the solution in Visual Studio,
I can't add a Controller : there is no "Controller...." option from the "Add" menu.
There is also no "Add View" when I right click inside of a Controller.
It seems to be treating all the projects in the solution as "Web Forms".
I think is has something to do with the last Windows update. It changed something.
I have the latest updates on Visual Studio.
Anyone have any idea how I can fix this?
Thanks
UPDATE : Solved. Need to install this update :
[ASP.NET and Web Tools 2013.1 for Visual Studio 2012][1] : [1]: http://blogs.msdn.com/b/webdev/archive/2013/11/18/announcing-release-of-asp-net-and-web-tools-2013-1-for-visual-studio-2012.aspx
You need to add {E3E379DF-F4C6-4180-9B81-6769533ABE47} as 'the first GUID' to in your project .csproj. You may not need to update your Visual Studio.
Refer to Context menu to Add Controller/View missing
Just two steps
1)Update your Visual studio 2013
2) unload your project from solution explorer then Reload it again.