mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-08-23 22:20:28 +08:00
- Scaffolding a new module should not add a reference from Orchard.Web to the module project (because dynamic compilation takes care of this now).
- Scaffold a new module should create a default directory structure that matches MVC projects, e.g. Controllers, Views, Models, Scripts, Content... --HG-- branch : dev
This commit is contained in:
parent
3da92e40f3
commit
1ddfe42b1b
@ -140,14 +140,6 @@ namespace Orchard.DevTools.Commands {
|
||||
CreateFilesFromTemplates(moduleName, projectGuid);
|
||||
// The string searches in solution/project files can be made aware of comment lines.
|
||||
if (IncludeInSolution) {
|
||||
// Add project reference to Orchard.Web.csproj
|
||||
string webProjectReference = string.Format(
|
||||
"</ProjectReference>\r\n <ProjectReference Include=\"Modules\\{0}\\{0}.csproj\">\r\n <Project>{{{1}}}</Project>\r\n <Name>{0}</Name>\r\n ",
|
||||
moduleName, projectGuid);
|
||||
string webProjectText = File.ReadAllText(rootWebProjectPath);
|
||||
webProjectText = webProjectText.Insert(webProjectText.LastIndexOf("</ProjectReference>\r\n"), webProjectReference);
|
||||
File.WriteAllText(rootWebProjectPath, webProjectText);
|
||||
|
||||
// Add project to Orchard.sln
|
||||
string solutionPath = Directory.GetParent(rootWebProjectPath).Parent.FullName + "\\Orchard.sln";
|
||||
if (File.Exists(solutionPath)) {
|
||||
@ -177,6 +169,12 @@ namespace Orchard.DevTools.Commands {
|
||||
|
||||
Directory.CreateDirectory(modulePath);
|
||||
Directory.CreateDirectory(propertiesPath);
|
||||
Directory.CreateDirectory(modulePath + "Controllers");
|
||||
Directory.CreateDirectory(modulePath + "Views");
|
||||
File.WriteAllText(modulePath + "\\Views\\Web.config", File.ReadAllText(templatesPath + "ViewsWebConfig.txt"));
|
||||
Directory.CreateDirectory(modulePath + "Models");
|
||||
Directory.CreateDirectory(modulePath + "Scripts");
|
||||
|
||||
string templateText = File.ReadAllText(templatesPath + "ModuleAssemblyInfo.txt");
|
||||
templateText = templateText.Replace("$$ModuleName$$", moduleName);
|
||||
templateText = templateText.Replace("$$ModuleTypeLibGuid$$", Guid.NewGuid().ToString());
|
||||
|
@ -97,6 +97,7 @@
|
||||
<Content Include="ScaffoldingTemplates\ModuleCsProj.txt" />
|
||||
<Content Include="ScaffoldingTemplates\ModuleManifest.txt" />
|
||||
<Content Include="ScaffoldingTemplates\ModuleWebConfig.txt" />
|
||||
<Content Include="ScaffoldingTemplates\ViewsWebConfig.txt" />
|
||||
<Content Include="Views\Commands\Execute.ascx" />
|
||||
<Content Include="Views\DataMigration\Index.aspx" />
|
||||
<Content Include="Views\DefinitionTemplates\DevToolsSettings.ascx" />
|
||||
|
@ -70,6 +70,13 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Module.txt" />
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Views\Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers\" />
|
||||
<Folder Include="Models\" />
|
||||
<Folder Include="Scripts\" />
|
||||
<Folder Include="Content\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
|
||||
|
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<system.web>
|
||||
<httpHandlers>
|
||||
<add path="*" verb="*"
|
||||
type="System.Web.HttpNotFoundHandler"/>
|
||||
</httpHandlers>
|
||||
|
||||
<!--
|
||||
Enabling request validation in view pages would cause validation to occur
|
||||
after the input has already been processed by the controller. By default
|
||||
MVC performs request validation before a controller processes the input.
|
||||
To change this behavior apply the ValidateInputAttribute to a
|
||||
controller or action.
|
||||
-->
|
||||
<pages
|
||||
validateRequest="false"
|
||||
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<controls>
|
||||
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
|
||||
</controls>
|
||||
</pages>
|
||||
</system.web>
|
||||
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
<handlers>
|
||||
<remove name="BlockViewHandler"/>
|
||||
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
</configuration>
|
Loading…
Reference in New Issue
Block a user