question

RichardChang-0099 avatar image
0 Votes"
RichardChang-0099 asked TianyuSun-MSFT commented

Cannot find .NET 5.0 Console App project template in Visual Studio 2019

I'm currently trying to create a C# .NET 5.0 Console Application in Visual Studio 2019, and the option does not appear under project templates as I expect it to.

I downloaded Visual Studio Professional 2019 Version 16.9.4 (from https://visualstudio.microsoft.com/downloads/) and selected all workloads to be installed, then I installed SDK 5.0.202, ASP.NET Core Runtime 5.0.5, .NET Desktop Runtime 5.0.5, and .NET Runtime 5.0.5 (from https://dotnet.microsoft.com/download/dotnet/5.0).

When I go to File -> New -> Project and search for "Console Application", there is no default "Console Application" project template for C#. The closest I can find is "Console Application (.NET Framework)" for C#, VB, and F# and "Console Application" for C++. If I select "Console Application (.NET Framework)" for C#, the latest Framework that I can choose is ".NET Framework 4.8".

Actual Outcome:
8jz6m.png
uH5kf.png

I compared notes with a developer who did not run into this problem, and they see the same framework restriction when they select "Console Application (.NET Framework)" for C#, but is also able to see the project template "Console Application" for C# (without ".NET Framework") and select ".NET 5.0 (Current)" as the target framework as expected. Nothing about what they installed and updated appeared to be noticeably different, our results for the command prompt command "dotnet --info" matched, and they did not have any "Installed products" listed under "About" or "Individual Components" listed under the installer that I was missing.

Expected Outcome:
VTlAr.png
Iymaz.png

I have tried uninstalling and reinstalling everything, exhaustively installing every workload as well as additional individual components that looked potentially relevant, and making sure that the "Tools -> Options -> Environment -> Preview Features -> Show All .NET Core templates in the New project dialog (requires restart)" checkbox is checked.

Does anyone know what step I'm missing that is preventing me from creating a Console Application project template in C# using .NET 5.0?




dotnet-csharpvs-general
· 9
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

IThere is also VS General that discusses VS issues you can post to for help.

https://docs.microsoft.com/en-us/answers/products/vs

0 Votes 0 ·

Oh okay, thanks. Should I post a duplicate of this there?

0 Votes 0 ·

Did you scroll your first list to see all of the items?

0 Votes 0 ·

Yes, none are "Console App".

0 Votes 0 ·

Hi @RichardChang-0099 , does command line dotnet new console work for creating a new Console Application on your machine(in CMD, redirect to a new folder > type this command line)? Please try to repair VS, from VS Installer > VS 2019 > More > Repair.

0 Votes 0 ·

Command line responds with "The template 'Console Application' was created successfully.", but when I open the created .csproj file, I get an error "The system can not find the file specified." Repairing does not fix the issue, nor does uninstalling and re-installing.

0 Votes 0 ·

Hi @RichardChang-0099 , thanks for your feedback. Could you please help to confirm if obj folder, Program.cs and XXXX.csproj file has been successfully generated in the new folder? And may I ask, did this error(“The system can not find the file specified”) appear when you started VS > clicked File > Open > Project/Solution… > browse and choose the XXXX.csproj file?

0 Votes 0 ·
Show more comments

1 Answer

karenpayneoregon avatar image
0 Votes"
karenpayneoregon answered RichardChang-0099 commented

Hello,

Here is something to try.

  • Download the following zip file

  • Place the file in the folder C:\Users\ YourUserName \Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C#

  • Replace YourUserName with your login user name

  • Display the Start window.

  • Type in console

  • Visual Studio will take longer than usual to search, be patient, up to about three minutes.

  • When the progress bar stops, you should see what's shown below.

What's in the zip file? A console app where the project file is setup for .NET 5/ C# 9 e.g.

 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <OutputType>Exe</OutputType>
       <LangVersion>9.0</LangVersion>
       <TargetFramework>net5.0</TargetFramework>
   </PropertyGroup>
 </Project>

Other than that it's a plain Console project. Try building it, see if it build. If not come back and explain what happened.

Note: Notice I have several project on the left which I created my own project templates.

94106-figure1.png






figure1.png (71.7 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the response. I assume by "Display the Start window." you just mean to get the "Create a New Project" window to appear in Visual Studios, right? After I add the zip file to the folder specified, that custom project template in your screenshot does not appear, nor does the window take any time to search for it. It seems like it's not being recognized as a project template that is supposed to load at all.

I tried this on a machine without the issue I'm running into and got the same result as well. Is there a step missing from your instructions?

0 Votes 0 ·