当前位置:首页 > 技术积累 > 正文内容

【Orchard Core从零开始】(2)VS中使用模板创建CMS项目

竹林之风1个月前 (12-15)技术积累351

        除了手动方式创建Orchard Core项目,还可以通过模板创建。先通过以下dotnet new命令在命令提示符或VS Terminal中安装VS模板:

dotnet new install OrchardCore.ProjectTemplates::2.1.3

        其中2.1.3是版本号,如果要使用最新main分值,则运行如下命令安装:

dotnet new install OrchardCore.ProjectTemplates::2.1.3-* --nuget-source https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json

        然后就可以通过命令行自动创建CMS项目(各命令的详细参数列表可通过附加-h或--help参数查看):

dotnet new occms //自动创建CMS应用(Full CMS)
dotnet new ocmvc //自动创不含CMS功能的WEB应用(Orchard Core Framework),仅引用OrchardCore.Application.Cms.Core.Targets
dotnet new ocmodulecms //自动创建CMS模块(Full CMS)
dotnet new octheme //自动创建主题
dotnet new ocmodulemvc //自动创建不含CMS功能的模块(Orchard Core Framework)

        也可以在VS新建项目对话框中选择对应模板手动创建项目。

        所有命令的共同选项:

  -n, --name <name>       The name for the output being created. If no name is specified, the name of the output directory is used.
  -o, --output <output>   Location to place the generated output.
  --dry-run               Displays a summary of what would happen if the given command line were run if it would result in a template creation.
  --force                 Forces content to be generated even if it would change existing files.
  --no-update-check       Disables checking for the template package updates when instantiating a template.
  --project <project>     The project that should be used for context evaluation.
  -lang, --language <C#>  Specifies the template language to instantiate.
  --type <project>        Specifies the template type to instantiate.
  • -n, --name <name>:指定要创建的输出的名称。如果没有指定名称,则使用输出目录的名称。这通常用于设置项目名称。

  • -o, --output <output>:指定生成输出的位置。这决定了生成的模板或项目文件应该被放置在哪个文件夹中。

  • --dry-run:执行“干运行”模式,即不会实际执行任何操作,而是显示如果运行给定的命令行将会发生什么,特别是如果它会导致模板创建的话。这可以用于预览将要发生的更改。

  • --force:强制生成内容,即使这会更改现有文件。通常用于覆盖或更新已存在的文件。

  • --no-update-check:在实例化模板时禁用模板包的更新检查。这可以加快操作速度,特别是在不希望或不需要检查更新时。

  • --project <project>:指定用于上下文评估的项目。这个选项可能用于在多项目环境中指定应该使用哪个项目的上下文或设置。

  • -lang, --language <C#>:指定要实例化的模板语言。在这个例子中,C#被用作示例语言,但也可以指定其他编程语言。

  • --type <project>:指定要实例化的模板类型。这可以用于区分不同类型的模板,例如Web应用程序、控制台应用程序等。

        occms的特殊选项:

  -fm, --framework <net8.0>                 The target framework for the project. //指定目标框架,默认net8.0
                                            Type: choice
                                              net8.0  Target net8.0
                                            Default: net8.0
  -lo, --logger <NLog|None|Serilog>         Configures the logger component. //指定日志组件:NLog、Serilog或None,默认NLog
                                            Type: choice
                                              NLog     Configures NLog as the logger component.
                                              Serilog  Configures Serilog as the logger component.
                                              None     Do not configure logger.
                                            Default: NLog
  -ov, --orchard-version <orchard-version>  Specifies which version of Orchard Core packages to use. //指定Orchard Core版本号,默认2.1.3
                                            Type: string
                                            Default: 2.1.3

        ocmvc的特殊选项:

  -fm, --framework <net8.0>                 The target framework for the project. //指定目标框架,默认net8.0
                                            Type: choice
                                              net8.0  Target net8.0
                                            Default: net8.0
  -ov, --orchard-version <orchard-version>  Specifies which version of Orchard Core packages to use. //指定Orchard Core版本号,默认2.1.3
                                            Type: string
                                            Default: 2.1.3

        ocmodulecms的特殊选项:

  -fm, --framework <net8.0>                 The target framework for the project. //指定目标框架,默认net8.0
                                            Type: choice
                                              net8.0  Target net8.0
                                            Default: net8.0
  -A, --AddPart                             Add dependency injection for part in Startup.cs. If PartName is not provided, default name will be used //是否添加Part依赖注入
                                            Type: bool
                                            Default: false
  -P, --PartName <PartName>                 Add all files required for a part //指定Part名称
                                            Type: string
                                            Default: MyTest
  -ov, --orchard-version <orchard-version>  Specifies which version of Orchard Core packages to use. //指定Orchard Core版本号,默认2.1.3
                                            Type: string
                                            Default: 2.1.3

        octheme的特殊选项:

  -F, --Framework <net8.0>               The target framework for the project. //指定目标框架,默认net8.0
                                         Type: choice
                                           net8.0  Target net8.0
                                         Default: net8.0
  -A, --AddLiquid                        Add .liquid files in Views //是否添加.liquid视图文件,默认是
                                         Type: bool
                                         Default: true
  -O, --OrchardVersion <OrchardVersion>  Specifies which version of Orchard Core packages to use. //指定Orchard Core版本号,默认2.1.3
                                         Type: string
                                         Default: 2.1.3

        ocmodulemvc的特殊选项:

  -fm, --framework <net8.0>                 The target framework for the project. //指定目标框架,默认net8.0
                                            Type: choice
                                              net8.0  Target net8.0
                                            Default: net8.0
  -ov, --orchard-version <orchard-version>  Specifies which version of Orchard Core packages to use. //指定Orchard Core版本号,默认2.1.3
                                            Type: string
                                            Default: 2.1.3


扫描二维码推送至手机访问。

版权声明:本文由久爱编程网发布,如需转载请注明出处。

本文链接:https://www.9icode.com/index.php/post/381.html

标签: Orchard Core
分享给朋友:

“【Orchard Core从零开始】(2)VS中使用模板创建CMS项目” 的相关文章

HTTP长连接与短连接、长轮询与短轮询及长轮询的实现概述

HTTP长连接与短连接、长轮询与短轮询及长轮询的实现概述

        HTTP长连接(long connection)与短连接(short connection)本质上是TCP长连接和短连接:短连接是指在一次HTTP请求和响应之后立即关闭本次TCP连接,...

通用基础表逻辑设计(三)——功能权限

通用基础表逻辑设计(三)——功能权限

概述        在一个应用系统中有多个用户,用户通常分为多种角色,每种角色的用户能够访问的页面、能够查看的数据或者能够执行的操作等各有不同,因此需要设计与实...

云平台多租户系统的设计方案

云平台多租户系统的设计方案

        多租户(Multi Tenancy)是指在一个云平台上,多个不同的客户共用相同的平台和架构但又相互独立并对各自的用户提供服务。多租户相同有4个特...

ASP.NET中报“无法在已发送HTTP标头之后进行重定向”异常问题解决

ASP.NET中报“无法在已发送HTTP标头之后进行重定向”异常问题解决

        ASP.NET中报“无法在已发送HTTP标头之后进行重定向”异常时,其中一个原因是:在已经重定向后又重定向。在ASP.NET中实现重定向有以下几...

ASP.NET中报“无法在已发送HTTP标头之后设置状态”异常问题解决

ASP.NET中报“无法在已发送HTTP标头之后设置状态”异常问题解决

        ASP.NET中报“无法在已发送HTTP标头之后设置状态”异常,是因为设置Response的StatusCode之前,程序已设置响应标头。可从以...

ASP.NET网站自定义错误处理及其它安全相关

ASP.NET网站自定义错误处理及其它安全相关

        ASP.NET网站在运行过程中总是有可能报错,例如404等HTTP错误、500等程序异常。在IIS托管并报错的情况下,网站的默认行为依次是:(1).NET运行时接收并处理的部分显示.N...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。