Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Feature/msbuild #448

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Habitat.sln
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sitecore.Feature.Accounts.T
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sitecore.Feature.Demo.Tests", "src\Feature\Demo\tests\Sitecore.Feature.Demo.Tests.csproj", "{0CF1F7D9-121A-4E40-844C-612EC40345F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebRoot", "src\WebRoot\WebRoot.csproj", "{7985416B-3C47-4ABF-8603-73CAB10BEB03}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -613,6 +615,14 @@ Global
{0CF1F7D9-121A-4E40-844C-612EC40345F5}.Release|Any CPU.Build.0 = Release|Any CPU
{0CF1F7D9-121A-4E40-844C-612EC40345F5}.Release|x64.ActiveCfg = Release|Any CPU
{0CF1F7D9-121A-4E40-844C-612EC40345F5}.Release|x64.Build.0 = Release|Any CPU
{7985416B-3C47-4ABF-8603-73CAB10BEB03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7985416B-3C47-4ABF-8603-73CAB10BEB03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7985416B-3C47-4ABF-8603-73CAB10BEB03}.Debug|x64.ActiveCfg = Debug|Any CPU
{7985416B-3C47-4ABF-8603-73CAB10BEB03}.Debug|x64.Build.0 = Debug|Any CPU
{7985416B-3C47-4ABF-8603-73CAB10BEB03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7985416B-3C47-4ABF-8603-73CAB10BEB03}.Release|Any CPU.Build.0 = Release|Any CPU
{7985416B-3C47-4ABF-8603-73CAB10BEB03}.Release|x64.ActiveCfg = Release|Any CPU
{7985416B-3C47-4ABF-8603-73CAB10BEB03}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion publishsettings.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<publishUrl>http://habitat.dev.local</publishUrl>
<publishUrl>C:\inetpub\wwwroot\habitat.dev.local</publishUrl>
<ExcludeFilesFromDeployment>packages.config</ExcludeFilesFromDeployment>
</PropertyGroup>
<Import Project="./publishsettings.targets.user" Condition="exists('./publishsettings.targets.user')" />
Expand Down
7 changes: 5 additions & 2 deletions src/Feature/Accounts/code/Sitecore.Feature.Accounts.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -109,7 +109,10 @@
<Content Include="App_Config\Include\Feature\Feature.Accounts.config">
<SubType>Designer</SubType>
</Content>
<None Include="App_Config\Security\Domains.config.xdt" />
<None Include="App_Config\Security\Domains.config.xdt">
<ApplyTransformOnPublish>True</ApplyTransformOnPublish>
<SubType>Designer</SubType>
</None>
<None Include="Properties\PublishProfiles\Standalone.pubxml" />
<Content Include="Scripts\Accounts\Accounts.js" />
<Content Include="Views\Accounts\Login.cshtml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@
</ItemGroup>
<ItemGroup>
<Content Include="App_Config\Include\Foundation\Foundation.Accounts.config" />
<None Include="App_Config\Security\domains.config.xdt" />
<None Include="App_Config\Security\Domains.config.xdt">
<ApplyTransformOnPublish>true</ApplyTransformOnPublish>
</None>
<None Include="Properties\PublishProfiles\Standalone.pubxml" />
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -131,9 +131,14 @@
<SubType>Designer</SubType>
</Content>
<Content Include="App_Config\Include\Foundation\Foundation.SitecoreExtensions.Serialization.config" />
<None Include="App_Config\layers.config.xdt" />
<None Include="App_Config\Layers.config.xdt">
<ApplyTransformOnPublish>true</ApplyTransformOnPublish>
</None>
<None Include="web.config" />
<None Include="Properties\PublishProfiles\Standalone.pubxml" />
<None Include="Web.config.xdt">
<ApplyTransformOnPublish>true</ApplyTransformOnPublish>
</None>
<None Include="web.Debug.config">
<DependentUpon>web.config</DependentUpon>
</None>
Expand Down
4 changes: 3 additions & 1 deletion src/Project/Habitat/code/Sitecore.Habitat.Website.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@
<SubType>Designer</SubType>
</Content>
<Content Include="favicon.ico" />
<None Include="App_Config\layers.config.xdt" />
<None Include="App_Config\Layers.config.xdt">
<ApplyTransformOnPublish>true</ApplyTransformOnPublish>
</None>
<None Include="App_Data\packages\Habitat.xml" />
<None Include="Properties\PublishProfiles\Standalone.pubxml" />
<Content Include="App_Config\Environment\Project\Habitat.Dev.config">
Expand Down
21 changes: 21 additions & 0 deletions src/WebRoot/Helix.Module.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!--Default values -->
<ItemDefinitionGroup>
<None>
<ApplyTransformOnPublish>false</ApplyTransformOnPublish>
</None>
</ItemDefinitionGroup>

<Target
Name="GetTransformFilesToApplyOnPublish"
DependsOnTargets="PrepareForBuild;AssignTargetPaths"
Returns="@(_TransformFilesToApplyOnPublish)">

<ItemGroup>
<_TransformFilesToApplyOnPublish Include="@(_NoneWithTargetPath->'%(FullPath)')" Condition="'%(ApplyTransformOnPublish)' == 'true'"/>
</ItemGroup>

</Target>

</Project>
76 changes: 76 additions & 0 deletions src/WebRoot/Helix.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- Content Files-->

<PropertyGroup>
<PipelineCollectFilesPhaseDependsOn>
$(PipelineCollectFilesPhaseDependsOn);
CollectContentFilesFromHelixModules;
</PipelineCollectFilesPhaseDependsOn>
</PropertyGroup>

<Target Name="CollectContentFilesFromHelixModules">
<MSBuild Projects="@(ProjectReference)" Targets="ContentFilesProjectOutputGroup" BuildInParallel="$(BuildInParallel)">
<Output TaskParameter="TargetOutputs" ItemName="ContentFilesFromHelixModules" />
</MSBuild>
<ItemGroup>
<ContentFilesFromHelixModules>
<DestinationRelativePath>%(TargetPath)</DestinationRelativePath>
</ContentFilesFromHelixModules>

<FilesForPackagingFromProject Include="@(ContentFilesFromHelixModules)" />
</ItemGroup>
</Target>

<!-- Transform Files (extending Slow Cheetah)-->

<PropertyGroup>
<PipelineCollectFilesPhaseDependsOn>
$(PipelineCollectFilesPhaseDependsOn);
CollectTransformFilesToApplyOnPublish;
</PipelineCollectFilesPhaseDependsOn>
</PropertyGroup>

<Target Name="CollectTransformFilesToApplyOnPublish">
<MSBuild Projects="@(ProjectReference)" Targets="GetTransformFilesToApplyOnPublish" BuildInParallel="$(BuildInParallel)" Properties="CustomBeforeMicrosoftCSharpTargets=$(MSBuildThisFileDirectory)Helix.Module.targets">
<Output TaskParameter="TargetOutputs" ItemName="TransformFilesToApplyOnPublish" />
</MSBuild>

<ItemGroup>
<TransformFilesToApplyOnPublish>
<TransformFile>%(FullPath)</TransformFile>
<TargetPathToFileToTransform>$([System.IO.Path]::Combine($([System.IO.Path]::GetDirectoryName(%(TargetPath))),%(Filename)))</TargetPathToFileToTransform>
</TransformFilesToApplyOnPublish>

<TransformFilesToApplyOnPublish>
<DestinationFileInPackageDir>$(_PackageTempDir)\%(TargetPathToFileToTransform)</DestinationFileInPackageDir>
<DestinationFileInPublishDir>$(PublishUrl)\%(TargetPathToFileToTransform)</DestinationFileInPublishDir>
</TransformFilesToApplyOnPublish>
</ItemGroup>

<Message Text="Transform file to apply on publish: %(TransformFilesToApplyOnPublish.TransformFile) %(DestinationFileInPackageDir) %(DestinationFileInPublishDir)" Importance="normal" Condition="@(TransformFilesToApplyOnPublish) != ''"/>

<ItemGroup>
<FilesToCopyFromPublishDirToPackageDir Include="@(TransformFilesToApplyOnPublish -> '%(DestinationFileInPublishDir)')" Condition="Exists('%(DestinationFileInPublishDir)')">
<DestinationRelativePath>%(TargetPathToFileToTransform)</DestinationRelativePath>
</FilesToCopyFromPublishDirToPackageDir>
<FilesToCopyFromPublishDirToPackageDir Remove="@(FilesToCopyFromPublishDirToPackageDir)" Condition="@(FilesToCopyFromPublishDirToPackageDir) != '' and @(FilesForPackagingFromProject) != '' and %(DestinationRelativePath) != ''"/>

<FilesForPackagingFromProject Include="@(FilesToCopyFromPublishDirToPackageDir)" Condition=""/>
</ItemGroup>

<Message Text="File copied to package dir: %(FilesToCopyFromPublishDirToPackageDir.Identity)" Importance="normal" Condition="@(FilesToCopyFromPublishDirToPackageDir) != ''"/>
</Target>

<Target Name="ApplyTransformsOnPublish" AfterTargets="ScApplyWebTransforms" DependsOnTargets="CollectTransformFilesToApplyOnPublish">

<SlowCheetah.TransformTask Source="%(TransformFilesToApplyOnPublish.DestinationFileInPackageDir)"
Transform="%(TransformFile)"
Destination="%(DestinationFileInPackageDir)"
Condition="Exists('%(TransformFile)') and Exists('%(DestinationFileInPackageDir)')" />

<Message Text="Transformed %(TransformFilesToApplyOnPublish.DestinationFileInPackageDir) using %(TransformFile) into %(DestinationFileInPackageDir)" Importance="high" Condition="Exists('%(TransformFile)') and Exists('%(DestinationFileInPackageDir)')"/>

</Target>

</Project>
35 changes: 35 additions & 0 deletions src/WebRoot/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebRoot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebRoot")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7985416b-3c47-4abf-8603-73cab10beb03")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
18 changes: 18 additions & 0 deletions src/WebRoot/Properties/PublishProfiles/Habitat.pubxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\..\publishsettings.targets" />

<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
</Project>
30 changes: 30 additions & 0 deletions src/WebRoot/Web.Debug.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- For more information on using web.config transformation visit https://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".

<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.

<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
31 changes: 31 additions & 0 deletions src/WebRoot/Web.Release.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- For more information on using web.config transformation visit https://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".

<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.

<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
13 changes: 13 additions & 0 deletions src/WebRoot/Web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
For more information on how to configure your ASP.NET application, please visit
https://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.7.2"/>
<httpRuntime targetFramework="4.7.2"/>
</system.web>

</configuration>
Loading