Visual Studio 2017 MVC does not contain all source folders - c#

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.

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 C++ project on another PC fails to build

Tested with the following setup:
Home - VS2017 or VS2019
Classroom - VS2013 or VS2015.
I do code at home, then copy to my flash drive, bring it to the classroom and open a project from their PCs. Upon compilation I receive a big list of errors accessing standard header files, similar to this. Happens to me with every project I create at home, and the other way around: from the classroom to home PC.
This is something that doesn't happen with C# projects, which only ask me to change the .net framework version before opening, everything works fine here.
If you created a project in VS2013 and try to open it in VS2017 or VS2019 you might need additional changes.
Check this out- https://learn.microsoft.com/en-us/visualstudio/porting/port-migrate-and-upgrade-visual-studio-projects?view=vs-2019
If you created a project in the latest version say VS2019, it is very difficult to open it in older versions such as VS2013.
To fix it set the Omnipath to latest in vscode settings

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.

Running C# MVC project

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

Get Access to Microsoft Azure Inside Visual Studio

I have a windows phone application build for windows phone 8, in Visual Studio 2012. I have started incorporating azure, and found that Visual Studio 2013, was a smarter choice for this. Therefore I installed the new VS, and opened the file, but I cannot get it to upgrade the solution.
I use the Visual Studio Version Selector as default opener, and it open the solution in my VS2013. But it is still VS2012 version, as can be seen on the picture:
I have tried to use Save as, which is stated as a solution here. But still the solution does not change. Anyone has a suggestion for how to upgrade the solution to VS2013?
What I want to use is what is shown in this video on Channel9. So I need to some how upgrade my project, or do I have to copy the code to a new project :-/ ?
I tried installing the SDK's from Microsoft Azure, but still no luck.
EDIT
The feature where you add connected service is not available for windows phone. And you do therefore not need to upgrade the VS solution. But still I had problems getting access to the server.
Go to "View", and click "Server Explorer". There one can see a windows/Azure logo, by clicking it you will add your windows azure account. apparently this does not mean adding your services even though it states that you are logged in and with the correct subscription.
Solution
However the solution I stumbled upon was to add a new Mobile Service. Where then get prompted to choose my subscription which then was not there. Apparently the subscriptions can be loaded in different ways. Therefore in this new popup under subscriptions choose import. And you basically get the route described.
After importing the subscription, you then cancel creating a new services(If you did not need it :)). And now all your azure stuff will be accessible to manage as seen in this link.
However it does not create the code lines since you are not using "add connected services" which is possible in windows apps.
Finally an answer :)
You cannot convert solution from Visual Studio 2012 to 2013 because it is not changed at all.
Sln is just xml file and it is remain same so there is no need to convert it from 2012 to 2013

Categories