控制台应用程序 (.Net Standard) 未列出 [英] Console App (.Net Standard) not listed

查看:29
本文介绍了控制台应用程序 (.Net Standard) 未列出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Visual Studio 2017 并尝试创建控制台应用程序 (.Net Standard)".当我执行文件 -> 新建项目..."时,它不再出现在我的可用项目列表中

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..."

几分钟前就在那里.在我创建了一个控制台应用程序 (.Net Core)"然后删除该应用程序后它就消失了,因为我意识到我真的想要一个标准应用程序.

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.

我通过从 Visual Studio 中删除它来删除它,然后转到文件系统并删除它.

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

我尝试运行安装程序并更新 2017 安装.那没有帮助.

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

如何将控制台应用程序(.Net 标准)"用作要创建的项目类型?

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

我已经关闭并重新启动了 Visual Studio.

I have shutdown and restarted visual studio.

我试图运行 devenv/installvstemplates 但没有找到 devenv 命令.我发现它位于:C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE.调用它的首选方式是什么?[添加到路径或其他方式?]

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?]

我是这样运行的:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe"/installvstemplates 并得到一个 操作无法完成.请求的操作需要提升..

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..

我是这样运行的:runas/user:Administrator "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe"/installvstemplates 并得到RUNAS 使用帮助信息.

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.

我在具有管理员权限的 powershell 窗口中运行命令并得到这个:

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

发现我需要运行带有 & 前缀的引用命令.现在我可以运行 devenv.

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

在发布这个问题后,我决定我需要一个控制台应用程序(.Net 标准)":简单的无头窗口应用程序的项目类型

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

推荐答案

创建 .NET Standard 控制台应用没有意义.

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

您可以将 .NET Standard 视为 C# 中的接口..NET Standard 是一个接口,在.NET Framework、.NET Core 等平台上都有具体的实现..NET Standard 对类库有意义,但控制台应用程序需要实际运行在特定的具体实现上.

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.

因此,没有用于 .NET Standard 控制台应用程序的 Visual Studio 项目模板.您可以为 .NET Framework 或 .NET Core 创建控制台应用,然后使用 .NET Standard 类库.

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.

这篇关于控制台应用程序 (.Net Standard) 未列出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆