gpt4 book ai didi

c# - 使用代码生成模块在 orchard 中创建新主题

转载 作者:太空宇宙 更新时间:2023-11-03 21:08:11 25 4
gpt4 key购买 nike

我正在关注关于此 OrchardProject.net link 的文档.我打开并激活了 CodeGeneration 模块,并在项目 (Orchard.Web) 的根目录打开了命令提示符,并编写了“bin/Orchard.exe”来运行命令。到那时一切都很好。现在,当我尝试运行以下命令时,它给了我以下异常。命令是:

codegen 主题 mishrajiTheme/BasedOn:TheThemeMachine/CreateProject:true/IncludeInSolution:true

下面是命令的输出。

Creating Theme mishrajiTheme

Error executing command "codegen theme mishrajiTheme"

Specified argument was out of the range of valid values. Parameter name: startIndex

Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: startIndex

Stack Trace:

[ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: startIndex] at System.String.Insert(Int32 startIndex, String value) at Orchard.CodeGeneration.Commands.CodeGenerationCommands.AddToSolution(TextWriter output, String projectName, String projectGuid, String containingFolder, String solutionFolderGuid) at Orchard.CodeGeneration.Commands.CodeGenerationCommands.CreateThemeFromTemplates(TextWriter output, String themeName, String baseTheme, String projectGuid, Boolean includeInSolution) at Orchard.CodeGeneration.Commands.CodeGenerationCommands.IntegrateTheme(String themeName, String baseTheme) at Orchard.CodeGeneration.Commands.CodeGenerationCommands.CreateTheme(String themeName)


我在这里做错了什么或者它是 Orchard 代码生成模块中的错误。请指导。我使用的是 Orchard 1.10 版本。

最佳答案

我通过更改 Orchard 1.10 中第 434 行的 CodeGenerationCommands 类解决了这个问题。该行是:

 solutionText = solutionText.Insert(solutionText.LastIndexOf("EndProject\r\n"),   projectReference);

为此:

 solutionText = solutionText.Insert(solutionText.LastIndexOf("EndProject\n"), projectReference);

我不知道为什么 \r\n 找不到最终的 EndProject 并且通过将其更改为 \n 它工作正常

关于c# - 使用代码生成模块在 orchard 中创建新主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39804581/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com