mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-11-28 09:22:55 +08:00
#17061: Codegen'ing a theme should put the theme in the themes folder of the solution, not the modules folder.
--HG-- branch : 1.x
This commit is contained in:
@@ -16,6 +16,8 @@ namespace Orchard.CodeGeneration.Commands {
|
||||
public class CodeGenerationCommands : DefaultOrchardCommandHandler {
|
||||
private readonly IExtensionManager _extensionManager;
|
||||
private readonly ISchemaCommandGenerator _schemaCommandGenerator;
|
||||
private const string SolutionDirectoryModules = "E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5";
|
||||
private const string SolutionDirectoryThemes = "74492CBC-7201-417E-BC29-28B4C25A58B0";
|
||||
|
||||
private static readonly string[] _themeDirectories = new [] {
|
||||
"", "Content", "Styles", "Scripts", "Views", "Zones"
|
||||
@@ -191,7 +193,7 @@ namespace Orchard.CodeGeneration.Commands {
|
||||
CreateFilesFromTemplates(moduleName, projectGuid);
|
||||
// The string searches in solution/project files can be made aware of comment lines.
|
||||
if (IncludeInSolution) {
|
||||
AddToSolution(Context.Output, moduleName, projectGuid, "Modules");
|
||||
AddToSolution(Context.Output, moduleName, projectGuid, "Modules", SolutionDirectoryModules);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,13 +335,13 @@ namespace Orchard.CodeGeneration.Commands {
|
||||
}
|
||||
else {
|
||||
// create a project (already done) and add it to the solution
|
||||
AddToSolution(output, themeName, projectGuid, "Themes");
|
||||
AddToSolution(output, themeName, projectGuid, "Themes", SolutionDirectoryThemes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void AddToSolution(TextWriter output, string projectName, string projectGuid, string containingFolder) {
|
||||
private void AddToSolution(TextWriter output, string projectName, string projectGuid, string containingFolder, string solutionFolderGuid) {
|
||||
if (!string.IsNullOrEmpty(projectGuid)) {
|
||||
var solutionPath = Directory.GetParent(_orchardWebProj).Parent.FullName + "\\Orchard.sln";
|
||||
if (File.Exists(solutionPath)) {
|
||||
@@ -347,7 +349,7 @@ namespace Orchard.CodeGeneration.Commands {
|
||||
var projectConfiguationPlatforms = string.Format("GlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{{{0}}}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{{{0}}}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{{{0}}}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{{{0}}}.Release|Any CPU.Build.0 = Release|Any CPU\r\n", projectGuid);
|
||||
var solutionText = File.ReadAllText(solutionPath);
|
||||
solutionText = solutionText.Insert(solutionText.LastIndexOf("EndProject\r\n"), projectReference).Replace("GlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n", projectConfiguationPlatforms);
|
||||
solutionText = solutionText.Insert(solutionText.LastIndexOf("EndGlobalSection"), "\t{" + projectGuid + "} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}\r\n\t");
|
||||
solutionText = solutionText.Insert(solutionText.LastIndexOf("EndGlobalSection"), "\t{" + projectGuid + "} = {" + solutionFolderGuid + "}\r\n\t");
|
||||
File.WriteAllText(solutionPath, solutionText);
|
||||
TouchSolution(output);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user