Closed Tharnadar closed 6 years ago
Unicorn runs at a Sitecore level and is thus entirely unaware of visual studio and any of its conventions. Syncing also usually takes place on deployed systems where visual studio artifacts are not present even if the config were somehow keyed off VS. Take a look at how Habitat specifies a system level root path for serialized items in a vars file.
On Mon, Jan 22, 2018, 9:06 AM Tharnadar notifications@github.com wrote:
Hi everyone, I would like to specify a solution relative path (eg: $(SolutionDir)\Unicorn$(configurationName) ) for the configuration property targetDataStore in order to serialize items in a project/folder inside my solution (not in the IIS folder). We cannot use an absolute path, because we would like to have different items in different branches.
Is it possible somehow?
Thank you
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kamsar/Unicorn/issues/275, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGU_fH_IIWhOU_jyZXlX4eaaWRbu0Ktks5tNMAvgaJpZM4RoTwK .
Thank you Kasmar.
For those who are interested in a solution (or workaround), we have defined a sc.variable named solutionFolder, and with a custom T4 template, we have created a web.config transformation that replace the sc.variable value with the actual solution directory path.
<#@ template debug="false" hostspecific="true" language="C#" #><# /* hostspecific must be set to "true" in order to access Visual Studio project properties. */ #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Text" #>
<#@ output extension=".config" #>
<#@ assembly name="EnvDTE" #><# /* This assembly provides access to Visual Studio project properties. */ #>
<#
var serviceProvider = this.Host as IServiceProvider;
var dte = serviceProvider.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
var solutionDirectory = System.IO.Path.GetDirectoryName(dte.Solution.FullName);
#>
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<sitecore>
<sc.variable name="solutionFolder" value="<#= solutionDirectory #>"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</sitecore>
</configuration>
Finally we've changed the targetDataSource as below
<targetDataStore physicalRootPath="$(solutionFolder)\XXX.Unicorn\$(configurationName)" useDataCache="false" type="Rainbow.Storage.SerializationFileSystemDataStore, Rainbow" singleInstance="true"/>
Hi everyone, I would like to specify a solution relative path (eg: $(SolutionDir)\Unicorn\$(configurationName) ) for the configuration property targetDataStore in order to serialize items in a project/folder inside my solution (not in the IIS folder). We cannot use an absolute path, because we would like to have different items in different branches.
Is it possible somehow?
Thank you