Commit 66ec8801 authored by Viet Hoang's avatar Viet Hoang

Merge branch 'Release-2.4.0' into 'master'

Release 2.4.0

See merge request viet.hoang/my-simple-framework!86
parents 2efa7721 3d665347
......@@ -42,7 +42,6 @@ nCrunchTemp*.*
/publishsettings.targets
/TestResults
applicationhost.config
/src/Foundation/VietHoang.Sc/App_Config/Include/VietHoang/Foundation/VietHoang.Sc.DevSettings.config
*.dtbcache
*.lock
*.ide
......@@ -52,3 +51,6 @@ tools/*
!tools/packages.config
!local.pubxml
/cake-config.json
/src/Project/Common/VietHoang.Common.Web/App_Config/Include/VietHoang/Project/Common.LocalSettings.config
/scripts/Cake/tools
/tools
......@@ -14,38 +14,39 @@ For more information, please read the blog posts:
- https://buoctrenmay.com/2018/02/21/sitecore-9-and-my-simple-development-framework-version-2-1/
- https://buoctrenmay.com/2018/08/11/sitecore-9-and-my-simple-development-framework-version-2-2/
- https://buoctrenmay.com/2019/01/03/sitecore-9-and-my-simple-development-framework-version-2-3/
- https://buoctrenmay.com/2019/09/03/sitecore-9-and-my-simple-development-framework-version-2-4/
## Main Technologies:
- .Net Framework from version 4.7
- Sitecore XP version 9
- Glass Mapper Sitecore version 5.0: an object mapping framework for Sitecore https://github.com/mikeedwards83/Glass.Mapper
- Unicorn version 4.0.4: a Sitecore utility designed to simplify deployment of Sitecore items across environments automatically https://github.com/kamsar/Unicorn
- Sitecore XP version 9.2
- Glass Mapper Sitecore version 5.5: an object mapping framework for Sitecore https://github.com/mikeedwards83/Glass.Mapper
- Unicorn version 4.1: a Sitecore utility designed to simplify deployment of Sitecore items across environments automatically https://github.com/kamsar/Unicorn
- Microsoft Visual Studio Unit Testing Framework
- Sitecore.FakeDb version 1.7.2
- Sitecore.FakeDb version 1.7
## Setup Prerequisites
The following applications/tools/utilities are required on your local machine. The appropriate version of these items should be installed based on the version of your operating system and appropriate licensing.
+ Sitecore XP 9.1.0
+ Sitecore XP 9.2.0
+ IIS 10.0+
+ Visual Studio 2017 version 15.7 or later
+ SQL Server 2016 SP2 or later
+ IIS URL Rewrite 2.1
## Step-by-step Guide
1. Take a look at [this one](https://buoctrenmay.com/2018/11/29/sitecore-xp-9-1-step-by-step-install-guide-on-your-machine/) to setup a new **Sitecore 9.1.0** instance whose site name should be `viethoang.local`
1. Take a look at [this one](https://buoctrenmay.com/2019/07/23/sitecore-xp-9-2-initial-release-playing-around-with-custom-install-directory/) to setup a new **Sitecore 9.2.0** instance whose site name should be `viethoang.local`
+ add the host names `hoavi.local`, `demo.local` to **hosts** file
+ _Note: you can use [SIM](https://marketplace.sitecore.net/en/Modules/Sitecore_Instance_Manager.aspx) then open `Bundled Tools\Hosts Editor` in order to do that_
1. Site bindings:
+ bind the host names `hoavi.local`, `demo.local` to your Sitecore site (created in Step 1) via IIS
1. rename **cake-config.json.example** to **cake-config.json** and then update the following ones:
+ `WebsiteRoot` to **your Sitecore webroot folder**
+ `XConnectRoot` to **your xConnect webroot folder**
+ `InstanceUrl` to **your Sitecore instance url**
+ `ProjectFolder` to **your solution directory**
+ `WebsiteRoot` to **your Sitecore webroot folder** (Ex: "D:\\\\websites\\\\viethoang.local")
+ `XConnectRoot` to **your xConnect webroot folder** (Ex: "D:\\\\websites\\\\viethoang.xconnect.local")
+ `InstanceUrl` to **your Sitecore instance url** (Ex: "http://viethoang.local/")
+ `ProjectFolder` to **your solution directory** (Ex: "D:\\my-simple-framework")
1. rename **publishsettings.targets.example** to **publishsettings.targets** and then update the following one:
+ `<publishUrl>` to **your sitecore instance url** in case you don't use site name `viethoang.local` in step 1
1. rename **\src\Foundation\VietHoang.Sc\App_Config\Include\VietHoang\Foundation\VietHoang.Sc.DevSettings.config.example** to **VietHoang.Sc.DevSettings.config** and then update the following one:
+ `VietHoangSourceFolder` to **your solution directory**
1. rename **\src\Project\Common\VietHoang.Common.Web\App_Config\Include\VietHoang\Project\Common.LocalSettings.config.example** to **Common.LocalSettings.config** and then update the following one:
+ `VietHoangSourceFolder` to **your solution directory** (Ex: "D:\\my-simple-framework")
1. Enable URL Rewrite
+ install [IIS URL Rewrite 2.1](https://www.iis.net/downloads/microsoft/url-rewrite)
1. let's deploy the solution:
......@@ -56,3 +57,36 @@ The following applications/tools/utilities are required on your local machine. T
## Test Your Local Environment
+ open a browser, navigate to `hoavi.local/` and you should see the homepage without any errors
+ open a browser, navigate to `demo.local/` and you should see the homepage without any errors
## Create Deployment Folder
We can perform the build and deloy of a specific environment on the local by following these steps:
1. edit **cake-config.json** by updating the following ones:
+ `WebsiteRoot` to **your package folder** (Ex: "D:\\\\websites\\\\viethoang.local\\\\Release")
+ `BuildConfiguration` to appropriate one (Ex: _Release_ or _Release-Staging_)
1. let's deploy the solution:
+ launch PowerShell as an administrator
+ change directory to **your solution folder**
+ execute **.\build -target Quick-Deploy**
## How To Use The Project Templates
1. copy `\project_templates\VietHoang.Template.Web.zip`, `\project_templates\VietHoang.Template.ClassLibrary.zip` files
2. paste them to:
* **For VS 2015**, paste them to `%USERPROFILE%\Documents\Visual Studio 2015\Templates\ProjectTemplates`
* **For VS 2017**, paste them to `%USERPROFILE%\Documents\Visual Studio 2017\Templates\ProjectTemplates`
## Recommendations
Highly recommend that you should install some Visual Studio extensions below as well:
+ [SlowCheetah - XML Transforms](https://marketplace.visualstudio.com/items?itemName=vscps.SlowCheetah-XMLTransforms): it's helpful for creating transform files
+ [File Nesting](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.FileNesting): it's helpful for creating nest files
+ [Markdown Editor](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.MarkdownEditor): a full featured Markdown editor with live preview and syntax highlighting
## Notes
+ use [Cake](https://cakebuild.net/) (C# based) to build and deploy the solution as we can add additional build tasks easily and quickly
+ use [MSBuild .targets file](https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-dot-targets-files) to avoid adding the same file(s) to many projects (it's **VietHoang.Sitecore.targets**)
+ install [RazorGenerator.MsBuild](https://www.nuget.org/packages/RazorGenerator.MsBuild/) Nuget package to Asp.Net MVC projects (normally, they're in _Feature_ and _Project_ layer) so that we will **find out the invalid Razor syntax** soon. It's helpful to avoid deploying the Razor files which would be broken at runtime. The reference: https://kamsar.net/index.php/2016/09/Precompiled-Views-with-Sitecore-8-2/
+ **make the Sitecore solution testable** by using [Sitecore implementation of Dependency Injection](https://doc.sitecore.com/developers/82/sitecore-experience-platform/en/dependency-injection.html). The reference: https://kamsar.net/index.php/2016/08/Dependency-Injection-in-Sitecore-8-2/
+ we CANNOT **Lock and Edit** a Sitecore item if **Unicorns Transparent Sync** is enabled so please follow these steps to perform integration test on workflow:
1. open a browser, navigate to `viethoang.local/unicorn.aspx` and then synchronize all the Unicorns configurations
1. access `\Website\App_Config\Include\Unicorn\Unicorn.config` and then ensure that `enableTransparentSync="false"`
......@@ -46,18 +46,18 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Castle.Core" Version="3.3.3" />
<PackageReference Include="Glass.Mapper.Sc.91" Version="5.3.15" />
<PackageReference Include="Glass.Mapper.Sc.91.Core" Version="5.3.15" />
<PackageReference Include="Glass.Mapper.Sc.91.Mvc" Version="5.3.15" />
<PackageReference Include="Castle.Core" Version="4.4.0" />
<PackageReference Include="Glass.Mapper.Sc.92" Version="5.5.28" />
<PackageReference Include="Glass.Mapper.Sc.92.Core" Version="5.5.28" />
<PackageReference Include="Glass.Mapper.Sc.92.Mvc" Version="5.5.28" />
<PackageReference Include="Lucene.Net" Version="3.0.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.1.1" />
<PackageReference Include="Moq" Version="4.5.29" />
<PackageReference Include="Moq" Version="4.12.0" />
<PackageReference Include="SharpZipLib" Version="0.86.0" />
<PackageReference Include="Sitecore.FakeDb" Version="1.7.2" />
<PackageReference Include="Sitecore.Kernel" Version="9.1.0" />
<PackageReference Include="Sitecore.Logging" Version="9.1.0" />
<PackageReference Include="Sitecore.FakeDb" Version="1.7.4" />
<PackageReference Include="Sitecore.Kernel" Version="9.2.0" />
<PackageReference Include="Sitecore.Logging" Version="9.2.0" />
<PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="System.Collections.Concurrent" Version="4.3.0" />
<PackageReference Include="System.ComponentModel" Version="4.3.0" />
......
......@@ -47,10 +47,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.2.2" />
<PackageReference Include="Castle.Core" Version="3.3.3" />
<PackageReference Include="Glass.Mapper.Sc.91" Version="5.3.15" />
<PackageReference Include="Glass.Mapper.Sc.91.Core" Version="5.3.15" />
<PackageReference Include="Glass.Mapper.Sc.91.Mvc" Version="5.3.15" />
<PackageReference Include="Castle.Core" Version="4.4.0" />
<PackageReference Include="Glass.Mapper.Sc.92" Version="5.5.28" />
<PackageReference Include="Glass.Mapper.Sc.92.Core" Version="5.5.28" />
<PackageReference Include="Glass.Mapper.Sc.92.Mvc" Version="5.5.28" />
<PackageReference Include="Lucene.Net" Version="3.0.3" />
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.4" />
<PackageReference Include="Microsoft.AspNet.Razor" Version="3.2.4" />
......@@ -58,13 +58,13 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.1.1" />
<PackageReference Include="Microsoft.Web.Infrastructure" Version="1.0.0.0" />
<PackageReference Include="Moq" Version="4.5.29" />
<PackageReference Include="Moq" Version="4.12.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="SharpZipLib" Version="0.86.0" />
<PackageReference Include="Sitecore.FakeDb" Version="1.7.2" />
<PackageReference Include="Sitecore.Kernel" Version="9.1.0" />
<PackageReference Include="Sitecore.Logging" Version="9.1.0" />
<PackageReference Include="Sitecore.Nexus" Version="9.1.0" />
<PackageReference Include="Sitecore.FakeDb" Version="1.7.4" />
<PackageReference Include="Sitecore.Kernel" Version="9.2.0" />
<PackageReference Include="Sitecore.Logging" Version="9.2.0" />
<PackageReference Include="Sitecore.Nexus" Version="9.2.0" />
<PackageReference Include="Sitecore.Nexus.Licensing">
<Version>9.0.180604</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
......
......@@ -9,13 +9,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Configuration", "Configurat
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
.gitignore = .gitignore
build.cake = build.cake
build.ps1 = build.ps1
cake-config.json = cake-config.json
src\Project\Common\VietHoang.Common.Web\App_Config\Include\VietHoang\Project\Common.LocalSettings.config = src\Project\Common\VietHoang.Common.Web\App_Config\Include\VietHoang\Project\Common.LocalSettings.config
GlobalAssemblyInfo.cs = GlobalAssemblyInfo.cs
CakeScripts\helper-methods.cake = CakeScripts\helper-methods.cake
publishsettings.targets = publishsettings.targets
README.md = README.md
src\Foundation\VietHoang.Sc\App_Config\Include\VietHoang\Foundation\VietHoang.Sc.DevSettings.config = src\Foundation\VietHoang.Sc\App_Config\Include\VietHoang\Foundation\VietHoang.Sc.DevSettings.config
VietHoang.Sitecore.targets = VietHoang.Sitecore.targets
EndProjectSection
EndProject
......@@ -79,6 +78,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VietHoang.Feature.Seo", "sr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VietHoang.Multisolution", "src\Foundation\VietHoang.Multisolution\VietHoang.Multisolution.csproj", "{D0D13FDE-3BEC-4978-827B-C8940C38833D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cake", "Cake", "{3877037E-9D1D-4651-8196-92D37F3DC82C}"
ProjectSection(SolutionItems) = preProject
scripts\Cake\build.cake = scripts\Cake\build.cake
scripts\Cake\helper-methods.cake = scripts\Cake\helper-methods.cake
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -703,6 +708,7 @@ Global
{323CA7A6-6ABB-4652-ABE2-75DAB139CBC0} = {F6C46AD8-63DD-4593-87A8-8A5739729C56}
{5EC70F09-C1E3-4A42-9E35-F39F6A418225} = {5C7957D7-FFE1-4481-8E89-7B2C984E5BC9}
{D0D13FDE-3BEC-4978-827B-C8940C38833D} = {F6C46AD8-63DD-4593-87A8-8A5739729C56}
{3877037E-9D1D-4651-8196-92D37F3DC82C} = {F9DF8126-C92B-4F4A-A7D0-752EF0EE220A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2F593AC4-268D-4FAD-A9E2-895702FE346D}
......
......@@ -37,7 +37,7 @@ https://cakebuild.net
[CmdletBinding()]
Param(
[string]$Script = "build.cake",
[string]$Script = "scripts/cake/build.cake",
[string]$Target,
[string]$Configuration,
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
......@@ -238,5 +238,33 @@ $cakeArguments += $ScriptArgs
# Start Cake
Write-Host "Running build script..."
&$CAKE_EXE $cakeArguments
&$CAKE_EXE $cakeArguments --ErrorAction=Stop
if (!$Target.StartsWith("Quick", "CurrentCultureIgnoreCase"))
{
# Manage to stop and then start the application pool after the build and deploy in order to make "Transparent Sync of Unicorn" work properly
Write-Host "Stopping and then starting Application Pool..."
$appPoolName = "viethoang.*"
$isStopped = "false"
while ($isStopped -eq "false") {
try {
Stop-WebAppPool -Name $appPoolName -ErrorAction Stop
$isStopped = "true"
}
catch {
$isStopped = "false"
}
}
$isStarted = "false"
while ($isStarted -eq "false") {
try {
Start-WebAppPool -Name $appPoolName -ErrorAction Stop
$isStarted = "true"
}
catch {
$isStarted = "false"
}
}
}
exit $LASTEXITCODE
......@@ -10,7 +10,7 @@
// by using the '*' as shown below:
[assembly: AssemblyCompany("VietHoang")]
[assembly: AssemblyCopyright("Copyright © VietHoang 2018")]
[assembly: AssemblyCopyright("Copyright © VietHoang 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("0.0.1")]
[assembly: AssemblyInformationalVersion("0.0.1")]
......
......@@ -5,13 +5,17 @@ VisualStudioVersion = 15.0.27130.2003
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{88E686DE-29B3-42D7-BACB-187372E1F6E0}"
ProjectSection(SolutionItems) = preProject
GlobalAssemblyInfo.cs = GlobalAssemblyInfo.cs
..\README.md = ..\README.md
VietHoang.Sitecore.targets = VietHoang.Sitecore.targets
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VietHoang.Template.Web", "src\Layer\Module\VietHoang.Template.Web\VietHoang.Template.Web.csproj", "{1E8A5DDE-1600-4BDD-8F52-F566B1930329}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VietHoang.Template.ClassLibrary", "src\Layer\Module\VietHoang.Template.ClassLibrary\VietHoang.Template.ClassLibrary.csproj", "{95487CDF-B039-4C9E-A446-2359E7643D80}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Layer", "Layer", "{A9A67715-3DE5-4542-B2FB-15739E39ED62}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -35,6 +39,10 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1E8A5DDE-1600-4BDD-8F52-F566B1930329} = {A9A67715-3DE5-4542-B2FB-15739E39ED62}
{95487CDF-B039-4C9E-A446-2359E7643D80} = {A9A67715-3DE5-4542-B2FB-15739E39ED62}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9B89BB9C-8A9A-4716-845E-BB07BDAD7EE2}
EndGlobalSection
......
<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations
see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations
see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
</configuration>
\ No newline at end of file
......@@ -6,7 +6,7 @@
<mvc xdt:Transform="InsertIfMissing">
<precompilation>
<assemblies>
<assemblyIdentity name="VietHoang.Template.Web" />
<assemblyIdentity name="$safeprojectname$" />
</assemblies>
</precompilation>
</mvc>
......
......@@ -6,7 +6,7 @@
<mvc xdt:Transform="InsertIfMissing">
<precompilation>
<assemblies>
<assemblyIdentity name="VietHoang.Template.Web" />
<assemblyIdentity name="$safeprojectname$" />
</assemblies>
</precompilation>
</mvc>
......
using Microsoft.Extensions.DependencyInjection;
using Sitecore.DependencyInjection;
namespace VietHoang.Template.Web
{
public class DependenciesRegistration : IServicesConfigurator
{
public void Configure(IServiceCollection serviceCollection)
{
}
}
}
......@@ -43,10 +43,6 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Sitecore.Kernel" Version="[12.0.0]" />
<PackageReference Include="Sitecore.Mvc" Version="[3.0.0]" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data.DataSetExtensions" />
......@@ -66,22 +62,25 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Config\Include\VietHoang\VietHoang.Template.Web.config">
<Content Include="App_Config\Include\VietHoang\Feature\$safeprojectname$.config">
<TransformOnBuild>true</TransformOnBuild>
<SubType>Designer</SubType>
</Content>
<None Include="App_Config\Include\VietHoang\VietHoang.Template.Web.Debug.config">
<DependentUpon>VietHoang.Template.Web.config</DependentUpon>
<None Include="App_Config\Include\VietHoang\Feature\$safeprojectname$.Debug.config">
<DependentUpon>$safeprojectname$.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
<None Include="App_Config\Include\VietHoang\VietHoang.Template.Web.Release-Staging.config">
<DependentUpon>VietHoang.Template.Web.config</DependentUpon>
<None Include="App_Config\Include\VietHoang\Feature\$safeprojectname$.Release-Staging.config">
<DependentUpon>$safeprojectname$.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
<None Include="App_Config\Include\VietHoang\VietHoang.Template.Web.Release.config">
<DependentUpon>VietHoang.Template.Web.config</DependentUpon>
<None Include="App_Config\Include\VietHoang\Feature\$safeprojectname$.Release.config">
<DependentUpon>$safeprojectname$.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
<None Include="Properties\PublishProfiles\Local.pubxml" />
<None Include="Properties\PublishProfiles\Local.pubxml">
<SubType>Designer</SubType>
</None>
<None Include="Web.config">
<SubType>Designer</SubType>
</None>
......@@ -91,6 +90,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServicesConfigurators\DependenciesRegistration.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Views\web.config">
......@@ -108,6 +108,25 @@
<Folder Include="Models\" />
<Folder Include="Views\VietHoang\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection">
<Version>2.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions">
<Version>2.1.1</Version>
</PackageReference>
<PackageReference Include="RazorGenerator.MsBuild">
<Version>2.5.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Sitecore.Kernel">
<Version>9.2.0</Version>
</PackageReference>
<PackageReference Include="Sitecore.Mvc">
<Version>9.2.0</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
......@@ -149,4 +168,8 @@
<Target Name="AfterBuild">
</Target>
-->
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="BeforeBuild">
<TransformXml Source="App_Config\Include\VietHoang\Feature\$safeprojectname$.config" Transform="App_Config\Include\VietHoang\Feature\$safeprojectname$.$(Configuration).config" Destination="App_Config\Include\VietHoang\Feature\$safeprojectname$.config" />
</Target>
</Project>
\ No newline at end of file
......@@ -9,7 +9,7 @@
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
......@@ -36,7 +36,7 @@
<system.web>
<compilation>
<assemblies>
<add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
</system.web>
......
......@@ -2,6 +2,8 @@
<PropertyGroup>
<publishUrl>http://viethoang.local</publishUrl>
<ExcludeFilesFromDeployment>Views\web.config</ExcludeFilesFromDeployment>
<ExcludeFilesFromDeployment>packages.config</ExcludeFilesFromDeployment>
<ExcludeFilesFromDeployment>web.config</ExcludeFilesFromDeployment>
<ExcludeFilesFromDeployment>**\*.xdt</ExcludeFilesFromDeployment>
</PropertyGroup>
</Project>
\ No newline at end of file
......@@ -5,13 +5,13 @@
#addin nuget:?package=Cake.Json&version=3.0.1
#addin nuget:?package=Newtonsoft.Json&version=12.0.1
#load "local:?path=CakeScripts/helper-methods.cake"
#load "local:?path=helper-methods.cake"
var target = Argument<string>("Target", "Default");
var configuration = new Configuration();
var cakeConsole = new CakeConsole();
var configJsonFile = "cake-config.json";
var unicornSyncScript = $"./scripts/Unicorn/Sync.ps1";
var configJsonFile = $"../../cake-config.json";
var unicornSyncScript = $"../Unicorn/Sync.ps1";
/*===============================================
================ MAIN TASKS =====================
......@@ -36,6 +36,14 @@ Task("Default")
.IsDependentOn("Publish-Transforms")
.IsDependentOn("Sync-Unicorn-Root-Nodes");
Task("Quick-Deploy")
.WithCriteria(configuration != null)
.IsDependentOn("Clean")
.IsDependentOn("Init-Configuration")
.IsDependentOn("Publish-All-Projects")
.IsDependentOn("Apply-Xml-Transform")
.IsDependentOn("Post-Deploy");
/*===============================================
================= SUB TASKS =====================
===============================================*/
......@@ -46,29 +54,100 @@ Task("Clean").Does(() => {
});
Task("Init-Configuration").Does(() => {
var solutionConfigFolder = $"{configuration.WebsiteRoot}\\App_Config\\Include\\VietHoang";
var solutionConfigFolder = $"{configuration.WebsiteRoot}\\App_Config\\Include\\VietHoang";
CleanDirectories(solutionConfigFolder);
Information($"Cleaned the solution config folder \"{solutionConfigFolder}\"");
var unicornFolder = $"{configuration.WebsiteRoot}\\App_Config\\Include\\Unicorn";
CleanDirectories(unicornFolder);
Information($"Cleaned the Unicorn folder \"{unicornFolder}\"");
var solutionViewsFolder = $"{configuration.WebsiteRoot}\\Views\\VietHoang";
CleanDirectories(solutionViewsFolder);
Information($"Cleaned the solution Views folder \"{solutionViewsFolder}\"");
var appConfigPath = $"{configuration.WebsiteRoot}\\App_Config";
var commonProjectAppConfigPath = $"{configuration.ProjectFolder}\\src\\Project\\Common\\VietHoang.Common.Web\\App_Config";
var configFiles = new string[] {$"{commonProjectAppConfigPath}\\RewriteRules.config", $"{commonProjectAppConfigPath}\\RewriteMaps.config"};
if (!FileExists(appConfigPath))
{
CreateFolder(appConfigPath);
}
Information($"Build Configuration is \"{configuration.BuildConfiguration}\"");
var commonProjectPath = $"{configuration.ProjectFolder}\\src\\Project\\Common\\VietHoang.Common.Web";
var configFiles = new string[] {"App_Config\\RewriteRules.config"};
foreach(var configFile in configFiles)
{
if (!FileExists(configFile))
Information($"Config file is \"{configFile}\"");
var sourceFilePath = $"{commonProjectPath}\\{configFile}";
if (!FileExists(sourceFilePath))
{
continue;
}
var filePath = new FilePath(configFile);
if (!FileExists($"{appConfigPath}\\{filePath.GetFilename()}"))
var destinationFilePath = $"{configuration.WebsiteRoot}\\{configFile}";
if (!FileExists(destinationFilePath))
{
var filePath = new FilePath(destinationFilePath);
Information($"Copying the config file \"{sourceFilePath}\" to \"{filePath.GetDirectory()}\"");
CopyFileToDirectory(sourceFilePath, filePath.GetDirectory());
}
}
if (configuration.BuildConfiguration.Contains("Release"))
{
configFiles = new string[] {"web.config", "App_Config\\Layers.config"};
foreach(var configFile in configFiles)
{
Information($"Copying the config file \"{configFile}\" to \"{appConfigPath}\"");
CopyFileToDirectory(configFile, appConfigPath);
Information($"Config file is \"{configFile}\"");
var sourceFilePath = $"{commonProjectPath}\\{configFile}";
if (!FileExists(sourceFilePath))
{
continue;
}
var destinationFilePath = $"{configuration.WebsiteRoot}\\{configFile}";
if (!FileExists(destinationFilePath))
{
var filePath = new FilePath(destinationFilePath);
Information($"Copying the config file \"{sourceFilePath}\" to \"{filePath.GetDirectory()}\"");
CopyFileToDirectory(sourceFilePath, filePath.GetDirectory());
}
}
}
});
Task("Post-Deploy").Does(() => {
var commonLocalSettingsConfig = $"{configuration.WebsiteRoot}\\App_Config\\Include\\VietHoang\\Project\\Common.LocalSettings.config";
if (FileExists(commonLocalSettingsConfig))
{
DeleteFile(commonLocalSettingsConfig);
Information($"Deleted \"{commonLocalSettingsConfig}\"");
}
var rainbowConfig = $"{configuration.WebsiteRoot}\\App_Config\\Include\\Rainbow.config";
if (FileExists(rainbowConfig))
{
DeleteFile(rainbowConfig);
Information($"Deleted \"{rainbowConfig}\"");
}
var serializationHelixConfig = $"{configuration.WebsiteRoot}\\App_Config\\Include\\VietHoang\\Foundation\\VietHoang.Serialization.Helix.config";
if (FileExists(serializationHelixConfig))
{
DeleteFile(serializationHelixConfig);
Information($"Deleted \"{serializationHelixConfig}\"");
}
var serializationConfigs = $"{configuration.WebsiteRoot}\\App_Config\\Include\\VietHoang\\**\\*.Serialization.config";
DeleteFiles(serializationConfigs);
var unicornFolder = $"{configuration.WebsiteRoot}\\App_Config\\Include\\Unicorn";
DeleteDirectory(unicornFolder, recursive: true);
Information($"Deleted \"{unicornFolder}\"");
});
Task("Publish-All-Projects")
.IsDependentOn("Build-Solution")
.IsDependentOn("Publish-Foundation-Projects")
......@@ -90,12 +169,12 @@ Task("Publish-Feature-Projects").Does(() => {
Task("Publish-Project-Projects").Does(() => {
var common = $"{configuration.ProjectSrcFolder}\\Common";
var hoavi = $"{configuration.ProjectSrcFolder}\\Hoavi";
var demo = $"{configuration.ProjectSrcFolder}\\Demo";
var hoavi = $"{configuration.ProjectSrcFolder}\\Hoavi";
PublishProjects(common, configuration.WebsiteRoot);
PublishProjects(hoavi, configuration.WebsiteRoot);
PublishProjects(demo, configuration.WebsiteRoot);
PublishProjects(hoavi, configuration.WebsiteRoot);
});
Task("Apply-Xml-Transform").Does(() => {
......
---
ID: "92e04668-e00b-42d5-b3b0-adc7fcdb720f"
Parent: "5b0e9a46-e4ae-4d78-b910-36f7ada66d4c"
Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
Path: /sitecore/templates/VietHoang/Feature/Identity/_Identity/Organisation/Organisation Address
DB: master
SharedFields:
- ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
Hint: Type
Value: "Multi-Line Text"
- ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
Hint: __Sortorder
Value: 200
Languages:
- Language: en
Versions:
- Version: 1
Fields: