Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Console App (.Net Standard) not listed

I am using Visual Studio 2017 and trying to create a "Console App (.Net Standard)". It is no longer on my list of available projects when I do "File -> New Project..."

options in Visual Studio

It was there a few minutes ago. It disappeared after I created a "Console App (.Net Core)" and then deleted that app because I realized I really wanted a Standard app.

I deleted it by removing it from Visual Studio, then going to the file system and deleting it.

I tried running the installer and updating the 2017 install. That did not help.

How can I get "Console App (.Net Standard)" available as a project type to create?

[EDIT] I have shutdown and restarted visual studio.

[EDIT] I have attempted to run devenv /installvstemplates but the devenv command is not found. I found it located here: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE. What is the preferred way to call it? [add to path or some other way?]

[EDIT] I ran like this: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe" /installvstemplates and got a The operation could not be completed. The requested operation requires elevation..

[EDIT] I ran like this: runas /user:Administrator "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe" /installvstemplates and got a RUNAS usage help message.

[EDIT] I ran the command in a powershell window with Administrator privilege and got this:

PS C:\Windows\system32> 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv' /installvstemplates
At line:1 char:75
+ ... iles (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv' /installv ...
+                                                                  ~
You must provide a value expression following the '/' operator.
At line:1 char:75
+ ... \Microsoft Visual Studio 14.0\Common7\IDE\devenv' /installvstemplates
+                                                        ~~~~~~~~~~~~~~~~~~
Unexpected token 'installvstemplates' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : ExpectedValueExpression

[EDIT] found out that I need to run the quoted command prefixed with a &. Now I can run devenv.

[EDIT] I decided I needed a "Console App (.Net Standard)" after posting this question: Project Type for simple headless windows application

like image 961
Be Kind To New Users Avatar asked Aug 21 '17 00:08

Be Kind To New Users


People also ask

How do I get the console app in Visual Studio?

Open Visual Studio, and choose Create a new project in the Start window. In the Create a new project window, select All languages, and then choose C# from the dropdown list. Choose Windows from the All platforms list, and choose Console from the All project types list.

How do I publish a .NET framework console app?

Right-click on the HelloWorld project (not the HelloWorld solution) and select Publish from the menu. On the Target tab of the Publish page, select Folder, and then select Next. On the Specific Target tab of the Publish page, select Folder, and then select Next. On the Location tab of the Publish page, select Finish.

How do I change .NET to standard?

To do that, complete the following steps: In Visual Studio select Analyze and then Portability Analyzer Settings. In the General Settings window, select . NET Standard 2.0 under Target Platforms, and then choose OK.


1 Answers

It doesn't make sense to create a .NET Standard console app.

You can think of .NET Standard like you would an interface in C#. .NET Standard is an interface, then there's concrete implementations of it in .NET Framework, .NET Core and other platforms. .NET Standard makes sense for class libraries, but a console app needs to actually run on a specific concrete implementation.

Thus, there is no Visual Studio project template for .NET Standard console apps. You can create a console app for .NET Framework or .NET Core and then consume .NET Standard class libraries.

like image 121
mason Avatar answered Sep 19 '22 11:09

mason