'Cannot add plain C# file when project SDK is Microsoft.NET.Sdk.Web
I have a project that started out as a console application (it still is), but where I added ASP.NET Core so I could also use the Kestrel web server to host a simple UI. To get that to work, I changed the .csproj file to use the Microsoft.NET.Sdk.Web SDK:
<Project Sdk="Microsoft.NET.Sdk.Web">
...
</Project>
This makes everything work fine (if using Microsoft.NET.Sdk it cannot find the AspNetCore namespace), but when I want to add a plain and simple C# file, that template is not available when I do RMB -> Add New Item on the project.
I can easily add C# files by copying or creating an empty file and adding existing item, but because that option is not available from Visual Studio, I am getting the feeling I am doing something wrong.
Solution 1:[1]
It seems like the ASP.NET workload is installed on your computer.
- Run the Visual Studio installer
- Modify the installation
- Select ASP.NET and web development
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hemant |
