Running C# MVC project - c#

I was using my own computer with VS 2015 installed in it. When I run / played my Index.cshtml, it would run into URL
http://localhost:xxxx/Controller/Index
and it would run fine.
But then after my company told me to use their computer with VS 2012 instead, When I run / played my Index.cshtml, it would run into URL
http://localhost:xxxx/Views/Controller/Index.cshtml, then it would show error about cant find the right path.
what am I missing in my project? I tried to remove and re-add System.Web.MVC into my references, but it still the same. I have spent a lot of time try to fix it, but cant find the answer yet.
Or do I need to install some add-on into my VS?
**EDIT
sorry if I make you misunderstand my question. My question is, how to make my VS 2012 can run into the same URL with my VS 2015 automatically. because right now, each time I run my project in VS 2012, I need to edit my URL manually so that it could run into the right path and URL
thank you

if you create mvc project on vs 2015 there is a possibility you create a MVC 5 project that not have built in support on vs 2012. you need to install the extension.
The stand alone installer is located here:
https://www.microsoft.com/en-us/download/details.aspx?id=41532
The release/installation notes can be found at
http://www.asp.net/visual-studio/overview/2012/aspnet-and-web-tools-20131-for-visual-studio-2012
Dependency:
.NET 4.5
Included:
MVC5
Entity Framework 6
Web API 2
Bootstrap
Razor
Nuget 2.7

Thank to #Fedri Qrueger that I able to find the answer. Even after Installing the extension, the problem still occurs.
the solution that I found is to edit to project.
Right click on project => properties => web
Then change start action from Current Page into Specific Page, and leave it blank. as it answered in here

Related

Missing ASP.NET Core Web Application Template and all ASP.Net Core Templates in Visual Studio 2019

I do have a very odd problem with Visual Studio 2019 (Professional version 16.9.2) when trying to create a new project with a ASP.NET Core Web Application template.
Although I have a a lot of templates available, my list of new project is desperately not showing the template, and none of ASP.Net Core ones (the ones with the little planet, a circle and a blue dot icon) this is the icon I don't have, it's not taken from my machine
My version of VS is up to date, I've installed the .NET Core cross-platform development my Visual Studio configuration
I've installed the .NET Core package (I tried with all versions).
No matter which option I'm chosing in the Update tool, I still have the same list of templates, it never changes.
I've reinstalled VS from scatch. I've tried on 4 different machines (1 physical machine, 1 virtual desktop and 2 servers). I've also tried from line command prompt by using dotnet new, but I do have exactly the same list then the one in VS.
I've also tried to change the templates location from my local profile folder to the C:\Program Files(x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ProjectTemplates
But the templates list remains the same.
I'm out of ideas, sounds like I tried almost everything, for now I'm stuck!
If anyone among you has any idea or already had this issue, please let me know!
Thanks everyone for any help you could grant.
I finally found a way to have the 'missing' template. It seems that in VS 2019 the ASP.NET Core Web Application template has been replaced by the ASP.NET Core Empty.
I had to tweak it a little, but seems to be now Ok.
I hope this helps some folks
Install the ASP.NET and web development workload.
Visual Studio Installer -> Click on Modify -> Select ASP.NET and web development workload.

Visual Studio 2017 MVC does not contain all source folders

I have an issue with the new Visual Studio 2017 when starting a new ASP.NET MVC project. Recently I started a course on Udemy:
https://www.udemy.com/the-complete-aspnet-mvc-5-course/learn/v4/content
In this course I obviously try to mimic the teacher as perfectly as possible. However, I bought a new laptop yesterday and installed VS2017 on it (apparently you cannot get VS2015 as easily anymore). I followed the same steps as with VS2015 on my previous laptop, but it seems that the files generated by VS2017 are less than those generated by VS2015. Two of the files I'm missing are:
Startup.cs
Models/IdentityModels.cs
And there are several more missing, for instance regarding the Account Managing. The files in VS2017 look like this:
VS2017 MVC generated files
Unfortunately I don't have a snippet of the VS2015 version, since I already reset my old laptop to factory settings.
Are there others with the same issue, or is this standard since VS2017? Right now I can just look at what the teacher does, but later on he will introduce logging in and authentication, at which point I assume I will need that Account Manager .cs file.
Any help is appreciated.
Thanks to itsme86 and Jasen I found the "issue". Just needed to put the authentication model to "Individual user accounts" when creating the project. Stupid error from my side.

Intellisense not working in VS 2012

I downloaded a working MVC project to learn the actual MVC coding. On direct build, it gave me errors, I searched the net and as per suggestions I updated all the nuget packages and the other updates available. Now Razor is updated to 3.0, MVC to 5.2.3.0, Visual Studio to its latest version of VS 2012, and there is no intellisense anywhere on my project. I tried updating the web config with various values as suggested by users. I also tried updating the GUID. I created a fresh MVC 4 project and tried multiple times, but ended up updating the files and eventually back to Step 1. Its a hair pulling story now, as i cannot manage to get intellisense and all my work is stalled. Please help
This might do the trick for you
Tools->Options->Text Editor->C# (or All Languages)->General
and enable Auto List Members and Parameter Information in right hand side pane.

Web Project Templates Missing

I've installed the VS Community 2015 Update 1 but I'm not able to see the Web Project templates. I have done everything, reinstall, repair, reinstall the templates using devenv /installvstemplates, remove the ProjectTemplatesCache folder, pretty much everything I've found about similar issues but without results.
Any suggestion?
Thanks in advance
Well, the only thing that actually solved this issue: uninstall every single component manually installed (I assume that restoring the system to a previous point should work as well)...

Can't add Controller/View with MVC 5 after VS Update 4

After having installed the Update 4, Visual Studio 2013 don't recognize everything related to MVC anymore and a lot of things are underlined in red.
Assemblies such as System.Web.Html.HtmlHelper or System.Web.Mvc are presents in warning messages, but my applications still runs.
The problem is that now, I can't add a new Controller or add a View to a Controller, and this is really problematic when I want for example to generate a Controller with Views using Entity Framework.
I have tried to relaunch the Update4.exe with "Repair" option.
I also have tried to unintsall and reinstall VS2013.
Please answer me if you have a solution.
It sounds like you became a victim of MS14-059 windows update. Make sure that you are referencing correct assemblies not from GAC but these that you downloaded via NuGet.

Categories