#16949: Fixing scaffolded modules and themes when used in a non-source distribution

--HG--
branch : dev
This commit is contained in:
Dave Reed
2010-12-07 16:04:16 -08:00
parent c97a8d26cb
commit eab448cb21
2 changed files with 26 additions and 16 deletions

View File

@@ -45,35 +45,20 @@
<Reference Include="System.ComponentModel.DataAnnotations">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Mobile" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
$$FileIncludes$$<ItemGroup>
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
<Name>Orchard.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
<Name>Orchard.Core</Name>
</ProjectReference>
$$OrchardReferences$$
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

View File

@@ -254,9 +254,34 @@ namespace Orchard.CodeGeneration.Commands {
text = text.Replace("$$ModuleName$$", projectName);
text = text.Replace("$$ModuleProjectGuid$$", projectGuid);
text = text.Replace("$$FileIncludes$$", itemGroup ?? "");
text = text.Replace("$$OrchardReferences$$", GetOrchardReferences());
return text;
}
private static string GetOrchardReferences() {
return IsSourceEnlistment() ?
@"<ProjectReference Include=""..\..\..\Orchard\Orchard.Framework.csproj"">
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
<Name>Orchard.Framework</Name>
</ProjectReference>
<ProjectReference Include=""..\..\Core\Orchard.Core.csproj"">
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
<Name>Orchard.Core</Name>
</ProjectReference>" :
@"<Reference Include=""Orchard.Core"">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\bin\Orchard.Core.dll</HintPath>
</Reference>
<Reference Include=""Orchard.Framework"">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\bin\Orchard.Framework.dll</HintPath>
</Reference>";
}
private static bool IsSourceEnlistment() {
return File.Exists(Directory.GetParent(_orchardWebProj).Parent.FullName + "\\Orchard.sln");
}
private void CreateThemeFromTemplates(TextWriter output, string themeName, string baseTheme, string projectGuid, bool includeInSolution) {
var themePath = HostingEnvironment.MapPath("~/Themes/" + themeName + "/");
var createdFiles = new HashSet<string>();