dotnet nuget模板类型的包无法使用nuget包管理器安装。

huangapple go评论83阅读模式
英文:

why dotnet nuget packages of type template can't be installed using nuget package manager

问题

我正在尝试使用NuGet包管理器安装一个类型为模板的NuGet包。我一直在收到错误信息:

包 'Auth0.Templates 2.0.0' 具有一个不受项目 'ConsoleApp1' 支持的包类型 'Template'。

我正在尝试这样做是为了使我的现有项目根据此NuGet包中的模板进行修改。我在这里做错了什么?

英文:

I am trying to install a nuget package of type template using nuget package manager. I keep getting error

> Package 'Auth0.Templates 2.0.0' has a package type 'Template' that is not supported by project 'ConsoleApp1'.

I m trying to do this so that my existing project gets modified as per the template inside this Nuget package. what am I doing wrong here?

答案1

得分: 3

模板包是设计用于与 dotnet new 命令一起使用的。我相信一旦在命令行中从本地安装了模板,它也会在 Visual Studio 的新项目向导中可用,但我认为没有图形界面在 VS 中安装这样的模板包,你需要使用 CLI。

所以,打开一个终端,无论是来自 Windows 还是甚至是 VS 中的终端。然后你可以运行 dotnet new install Auth0.Templates

然后,你可以使用 dotnet new Auth0.WebAPI 或者他们提供的其他任何模板创建一个新项目(该包含了 4 个模板)。

不可能使用模板(包括其他形式的)来修改现有项目。你可以做的是在新目录中创建一个新项目,然后并排打开 csproj 文件,复制你想要的任何项目定义(对于模板可能包括的其他文件也是一样)。

英文:

Template packages are designed to work with the dotnet new command. I believe that once a template has been installed locally from the command line, it's also available in Visual Studio's new project wizard, but I don't think there's any GUI to install such template packages within VS, you need to use the CLI.

So, open a terminal, whether that's from Windows or even the terminal within VS. Then you can run dotnet new install Auth0.Templates.

Then, you can create a new project using dotnet new Auth0.WebAPI, or any other templates they provide (the package contains 4 packages).

It's not possible to use a template (package or otherwise) to modify an existing project. What you can do is create a new project in a new directory, then open the csproj files side by side and copy any project definitions you want (same for other files the template might include).

huangapple
  • 本文由 发表于 2023年7月10日 13:13:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/76650807.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定