• Orchard Core 使用模板创建Module


    根据官方示例:https://orchardcore.readthedocs.io/en/latest/Templates/README/#create-a-new-module

    执行以下命令:

    dotnet new --install "OrchardCore.Cms.Templates"

    PS C:Usershyzx8DocumentsVisual Studio 2017ProjectsJZProjectManage> dotnet new --install "OrchardCore.Cms.Templates"
    正在还原 C:Usershyzx8.templateenginedotnetcliv2.1.403scratch estore.csproj 的包...
    C:Usershyzx8.templateenginedotnetcliv2.1.403scratch estore.csproj : error NU1103: 找不到版本为 的稳定包 OrchardCore.Cms.Templates
    C:Usershyzx8.templateenginedotnetcliv2.1.403scratch estore.csproj : error NU1103: - 在 Orchard Core Nuget 中找到 20 个版本[ 最接近版本: 1.0.0-beta3-68792 ]
    C:Usershyzx8.templateenginedotnetcliv2.1.403scratch estore.csproj : error NU1103: - 在 nuget.org 中找到 3 个版本[ 最接近版本: 1.0.0-beta2-67846 ]
    C:Usershyzx8.templateenginedotnetcliv2.1.403scratch estore.csproj : error NU1103: - 在 Microsoft Visual Studio Offline Packages 中找到 0 个版本
    C:Usershyzx8.templateenginedotnetcliv2.1.403scratch estore.csproj : error NU1103: - 在 C:Program FilesdotnetsdkNuGetFallbackFolder 中找到 0 个版本
    正在生成 MSBuild 文件 C:Usershyzx8.templateenginedotnetcliv2.1.403scratchobj estore.csproj.nuget.g.props。
    正在生成 MSBuild 文件 C:Usershyzx8.templateenginedotnetcliv2.1.403scratchobj estore.csproj.nuget.g.targets。
    C:Usershyzx8.templateenginedotnetcliv2.1.403scratch estore.csproj 的还原在 251.62 ms 内失败。

      

    安装失败,此时参考微软官方的 api :https://docs.microsoft.com/zh-cn/dotnet/core/tools/dotnet-new?tabs=netcore21#examples

    -i|--install <PATH|NUGET_ID>

    从提供的 PATH 或 NUGET_ID 安装源或模板包。 若要安装模板包的预发布版本,需要以 <package-name>::<package-version> 格式指定该版本。 默认情况下,dotnet new 为该版本传递 *,表示最后一个稳定的包版本。 请在示例部分查看示例。

    注意以上命令中的高亮部分,由于OrchardCore 尚未发布稳定版,所以我们需要指定具体的版本号,在此之前你应确保已经添加了OrchardCore官方的 Nuget源: https://orchardcore.readthedocs.io/en/latest/Templates/README/#adding-orchard-core-nuget-feed

    将命令修改为:

    dotnet new --install "OrchardCore.Cms.Templates::1.0.0-beta3-68792"

    注意后方的版本号来自于 上一个命令的 最接近版本 部分

    接下来再按照官方文档继续执行就没问题了

    New module from Command Shell (automated way)

    Module commands

      dotnet new ocmodule -n ModuleName.OrchardCore

    dotnet new ocmodule -n ModuleName.OrchardCore --PartName TestPart
    
    dotnet new ocmodule -n ModuleName.OrchardCore --PartName TestPart --AddPart true
  • 相关阅读:
    Nginx 在 Linux 下安装与搭建集群
    php服务器环境安装及项目搭建
    安全运维 -- Linux服务器使用公私钥密匙证书登录
    Linux 使用nexus搭建maven私服
    lombok使用教程
    Java爬虫项目实战(一)
    CGI,FastCGI和PHP-FPM之间的关系和区别
    IPv6、双栈与隧道
    mysql时间戳转日期
    socket通讯原理及例程(一看就懂
  • 原文地址:https://www.cnblogs.com/Qbit/p/9778128.html
Copyright © 2020-2023  润新知