OrchardCMS/OrchardDoc

"codegen module" cannot add module to Orchard.sln

feO2x opened this issue · 3 comments

feO2x commented

Hey everybody,

I'm currently learning about Orchard Modules using the Getting Started with Modules Course using Orchard v1.10.2 in VS2017 Community. When I try to run the command codegen module Orchard.LearnOrchard.FeaturedProduct, this command fails with the following message:

Error executing command "codegen module Orchard.LearnOrchard.FeaturedProduct"

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.IntegrateModule(String moduleName)
at Orchard.CodeGeneration.Commands.CodeGenerationCommands.CreateModule(String moduleName)


Command returned non-zero result: Fail

I noticed that this exception is thrown when the Orchard Command Line Interface is trying to add the project to the solution, when I run codegen module Orchard.LearnOrchard.FeaturedProduct /IncludeInSolution:false, then the command executes successfully.

I don't know if this is a bug that should belong in the official Orchard repo, or if I made something wrong. Before, I just created a new theme using Orchard.exe.

Have you renamed your Orchard.sln to something else?

feO2x commented

No, I haven't.

Hmm looks like other people are seeing the issue (OrchardCMS/Orchard#7699) so it's probably not a documentation problem as it used to work.

The structure of the sln file must have changed in some way that its not finding the right place to insert it any more.

Closing it on here as it's now referenced in the proper issue.