2
votes

I have looked everywhere for a solution to this but I am having no luck.

I have created an MVC app through the command line with the TargetFramework of netcoreapp2.0 and I can't add any .cs files to the project through the Add Class/Item in Visual Studio 2017.

I also don't get the option to create a new project with netcoreapp2.0

I have tried:

  1. Uninstalling and reinstalling VS2017
  2. Uninstalling and reinstalling NetCore SDK
  3. Installing 32bit NetCore SDK

I have the following installed from the VS2017 Installer

  1. .NET Desktop Development
  2. ASP.Net and Web Development
  3. .NET Core Cross-Platform Development

enter image description here

enter image description here

EDIT: I reinstalled windows and I no longer get the error below, but I still don't see the cs file option within VS.

I get the following error when installing VS2017

EDIT 2: After repairing VS2017 I looked in programs and features and I 2 versions of dot net core installed. I uninstalled the older (64 bit) version, also removed the old version from PATH variables and this fixed it!

enter image description here

Thanks

1
What kind of OS? The error says it could not enable ASP.NET 4.x on your local IIS, which you should spend some time analyzing before trying again. If IIS is broken, you might have to reinstall the whole OS to fix it. - Lex Li
I'm on Windows 10. I have searched for a fix for the error above and there are quite a few others having that problem and they haven't found a valid fix for it. I'll try to repair the OS through the USB install after xmas - SkelDave
Reinstalled windows and the VS install error has disappeared. Still got issues with not seeing templates for dot net core & cs files - SkelDave

1 Answers

1
votes

It ended up being a corrupt install of Windows. Once I downloaded the windows USB tool and reinstalled it I could repair my VS2017 installation.

I then removed the old 64 bit version of dot net core, removed the old environment variable for the 64 bit version, restarted my PC and everything looks like its working.