简体   繁体   English

在 Visual Studio 2019 中找不到 nuget 安装的模板

[英]Can't find template installed by nuget in visual studio 2019

I want to install Antlr4 Console App template mentioned inhere ,and nuget console tell me that I install it sucessfully.我想安装这里提到的 Antlr4 Console App 模板,nuget 控制台告诉我安装成功。

But I can't find this template in create new project menu.但是我在创建新项目菜单中找不到这个模板。 enter image description here在此处输入图像描述

And I try to install it again,but nuget tell me "The template "Antlr4 Console App" was created successfully."我尝试再次安装它,但 nuget 告诉我“模板“Antlr4 控制台应用程序”已成功创建。”

The VS IDE does not contain the Antlr4 Console App template automatically. VS IDE 不自动包含Antlr4 控制台应用程序模板 And it is for dotnet cli project template automatically(using command line to create).它是自动为dotnet cli 项目模板(使用命令行创建)。

If you want to create Antlr4 Console App template for VS IDE, you should follow these steps:如果您想为 VS IDE 创建 Antlr4 Console App 模板,您应该按照以下步骤操作:

1) open CMD as Administrator and then type this to create the template for dotnet cli: 1)以管理员身份打开CMD ,然后键入以下内容为 dotnet cli 创建模板:

dotnet new -i Antlr4BuildTasks.Templates::8.9.1

then ,那么

cd xxxx(a default empty folder which for the created project by dotnet cli)
dotnet new antlr

2) open the created antlr project by VS IDE 2)通过VS IDE打开创建的antlr项目

在此处输入图像描述

After that , click VS top menu Project --> Export Template --> Project Template之后,点击 VS 顶部菜单Project --> Export Template --> Project Template

在此处输入图像描述

Input the info like my description and then click Finish .输入我的描述等信息,然后单击完成

3) Close VS, copy the generated Antlr4 Console App.zip file into C:\Users\xxx\Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C# : 3)关闭VS,将生成的Antlr4 Console App.zip文件复制到C:\Users\xxx\Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C# :

在此处输入图像描述

4) restart VS and click new project. 4)重启VS并点击新建项目。

For newly added templates, VS search and location are not too accurate, so often the template is at the end of the search results,对于新添加的模板,VS搜索和定位不是太准确,所以经常模板在搜索结果的末尾,

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM