In Visual Studio 2013, I am missing the add MVC Controller - Empty scaffolding item.
When I right click the controllers folder, then Add, and click the controller option at the top of the menu. The Add Scaffold popup window appears with only a list of Web API 2 controllers to add.
http://postimg.org/image/bz5rze56n/ <--- Image here
Just to see if it is only this project, I created a new empty mvc project and followed the same steps and I did have the mvc controllers in there.
Does anyone know how I can get those options back in my main project? I'd rather not just copy and paste my existing controllers. :-P
Thank you for any help you may provide!
I know this is an old topic, but I found if you instead of using the Add->Controller option in the context menu, but instead use Add->New Item option, then choose MVC Controller and name it, then this also creates the same structure as the Empty Controller template.
shut down all running Visual studio's
run VisualStudio command prompt as admin.
type this: devenv /installvstemplates
Related
I cannot find a way to create an Empty Web application in VS2017(ASP.NET WebForm).
In VS2015 there was a template for this.
Seems like VS2017 can only create Empty Web Site.
This is what I have :
==============================================
Update for the whoever see this post in future: I Ended up rebooting my computer AND VS2017 did some updates. After that, The Empty Template appeared! Clearly a VS 2017 bug.
Go to File > New Project
This will prompt you to the following Dialog where you choose for a Web App.
Then you will get to the point where you can choose a template
I have a working MVC 5 web application. everything was ok until suddenlly i found out that i cannot add a view to the application and the add button is disabled.
I use VS 2015 Entrprise update 3 RC.
C# as a programming language.
the project type GUIDS tag looks like this
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
please help me with this.
Thanks all
Your ProjectTypeGuids look ok. You can view a list of ProjectTypeGuids here.
I have Visual Studio 2015 Community Edition here and it works fine when I try to add a View clicking on Views folder and an Action inside a Controller.
There are some similar questions here at stackoverflow, maybe they can help you:
Cannot add view to ASP.NET MVC 5 project
Visual Studio 2013 button to add a View is disabled
Can you give more information about how you are trying da add that View please?
Some tests
I can reproduce clicking on the Views folder and the add button is disabled if I choose Template: Empty and don't select any Model Class:
The only way the button Add will be enabled with no Model Class selected is if I choose Empty (Without Model):
Make sure you have all the following installed:
Modifying VS -> workloads -> installation details
For a Sitecore7 solution I setup an ASP.net MVC3 project. I'm trying to add a new view to my controller action using the "Add view" wizard, by clicking right on the View() code > Add view.
public class HomeController : SitecoreController
{
public ActionResult Add()
{
return View();
}
}
The "Add view" wizard shows up, but when I checked the checkbox "Create a strongly-typed view" the Model class dropdownlist is empty.
There are no build errors. However I cleaned, build and rebuild the solution, but that doesn't fix the problem. I'm using Visual Studio 2012 and the enviroment is completely updated.
I searched the internet and found this simular looking issue, but the solution doesn't fix the problem.
I have tried to fix it in a day, without success. Does anyone know a solution?
Thanks a lot.
Jordy
You can just type in the model at the top of your view, like this:
#model your.namespace.goes.here
1.FIRST YOU DELETE ALL FILES IN YOUR APPLICATION BIN FOLDER.THEN TRY BUILD THE APPLICATION. OR
2.DO THE FIRST STEP AND IF YOU ARE USING EF TRY TO UPDATE YOUR DATABASE BY TYPING "update-database" from your package manager console
The simplest way to add a strongly-typed View is:
right click your Views folder -> Add -> Scaffold item -> MVC view
From there you can select whatever model and type you have available in the project. However, keep in mind that old MVC templates (like MVC 3) might not have all options available.
Firstly, I'm new to ASP.Net and MVC, so still finding my feet. I seem to have a problem whereby when I close and re-open my project, the list of 'Model Class' shown in the 'Add Controller' dialog comes up blank and no matter what I do I cannot get it to show anything and yes I have tried rebuilding and searching the net for a solution.
I've broken my process down into some real simple steps that reproduce the problem every time...
1) Create new ASP.Net MVC5 project
2) Add a model class
3) Create a db context class within a DAL folder
4) Save and build
5) Right-click to add a controller, the dialog shows the list of model classes in the drop down. Click cancel.
6) Close the project and then re-open the project, you don’t need to close VS.
7) Rebuild the project
8) Right-click to add a controller, the dialog now shows a blank list of model classes in the drop down. Arghh!
I can only assume I'm missing something obvious.
Thanks
Chris
Bingo! Just two steps
1)Update your Visual studio 2013 to new update release.
2) unload your project from solution explorer then Reload it again.
In Visual Studio when I press F5 in this particular MVC3 project, it opens:
localhost:36185/Views/Auction/Details.cshtml
When in any other project, when I press F5 it correctly open the Home/Index action method:
http://localhost:36185
Why is this opening a specific View instead of using the correct Home/Index action? What setting is interfering?
Project properties => Web => Start Action
and take your pick
You can try the solution given by Marc Gravell. If that doesn't work, you might want to check the Global.ascx file for routing configuration.