2017-06-28 3 views
0

GulpタスクでXMLTransformタスクを実行すると、要素を変換する代わりにSitecoreアプリケーションweb.configファイルの内容全体が置き換えられます。理由は分かりませんか? 1のSitecore helix Apply-Xml-Transformは、変換する代わりにweb.config全体を置き換えます

私はこれまでのところ、その中にはほとんどを持っているXML-ドキュメント変換の名前空間を持っているどちらも私の溶液中でのさまざまなプロジェクトで2倍web.config.transformファイルを、持っている...例はここにある:

<?xml version="1.0" encoding="utf-8"?> 

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 
    <runtime xdt:Transform="InsertIfMissing"> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" xdt:Transform="InsertIfMissing"> 
     <dependentAssembly xdt:Transform="InsertIfMissing"> 
     <assemblyIdentity xdt:Transform="InsertIfMissing" name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/> 
     <bindingRedirect xdt:Transform="InsertIfMissing" oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> 
     </dependentAssembly> 
     <dependentAssembly xdt:Transform="InsertIfMissing"> 
     <assemblyIdentity xdt:Transform="InsertIfMissing" name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/> 
     <bindingRedirect xdt:Transform="InsertIfMissing" oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> 
     </dependentAssembly> 
     <dependentAssembly xdt:Transform="InsertIfMissing"> 
     <assemblyIdentity xdt:Transform="InsertIfMissing" name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/> 
     <bindingRedirect xdt:Transform="InsertIfMissing" oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0"/> 
     </dependentAssembly> 
     <dependentAssembly xdt:Transform="InsertIfMissing"> 
     <assemblyIdentity xdt:Transform="InsertIfMissing" name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/> 
     <bindingRedirect xdt:Transform="InsertIfMissing" oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 

<system.codedom xdt:Transform="InsertIfMissing"> 
<compilers xdt:Transform="InsertIfMissing"> 
    <compiler xdt:Transform="InsertIfMissing" xdt:Locator="Match(language)" language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /> 
    <compiler xdt:Transform="InsertIfMissing" xdt:Locator="Match(language)" language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" /> 
</compilers> 
</system.codedom> 
</configuration> 

マイgulpfileはかなりの在庫標準ヘリックス1されています

gulp.task("04-Apply-Xml-Transform", function() { 
var layerPathFilters = ["./src/Foundation/**/*.transform", "./src/Feature/**/*.transform", "./src/Project/**/*.transform", "!./src/**/obj/**/*.transform", "!./src/**/bin/**/*.transform"]; 
return gulp.src(layerPathFilters) 
    .pipe(foreach(function (stream, file) { 
     var fileToTransform = file.path.replace(/.+code\\(.+)\.transform/, "$1"); 
     util.log("Applying configuration transform: " + file.path); 
     return gulp.src("./scripts/applytransform.targets") 
      .pipe(msbuild({ 
       targets: ["ApplyTransform"], 
       configuration: config.buildConfiguration, 
       logCommand: false, 
       verbosity: "normal", 
       stdout: true, 
       errorOnFail: true, 
       maxcpucount: 0, 
       toolsVersion: config.buildToolsVersion, 
       properties: { 
        Platform: config.buildPlatform, 
        WebConfigToTransform: config.websiteRoot, 
        TransformFile: file.path, 
        FileToTransform: fileToTransform 
       } 
      })); 
    })); 
}); 

applytransform.targetsファイルも株式らせんいずれかになります。

<Project ToolsVersion="14.0" DefaultTargets="ApplyTransform" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(MSBuildToolsVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" /> 
    <Target Name="ApplyTransform"> 
    <ItemGroup> 
     <Transform Include="$(TransformFile)" /> 

     <ConfigsToTransform Include="$(FileToTransform)" Condition="Exists(@(Transform))"> 
     <TransformPath>%(Transform.Identity)</TransformPath> 
     </ConfigsToTransform> 
    </ItemGroup> 
    <Message Text="@(ConfigsToTransform)"></Message> 
    <Message Text="@(Transform)"></Message> 

    <TransformXml Source="$(WebConfigToTransform)\%(ConfigsToTransform.Identity)" 
       Transform="%(ConfigsToTransform.TransformPath)" 
       Destination="$(WebConfigToTransform)\%(ConfigsToTransform.Identity)" 
       Condition="Exists(@(Transform))"/> 
     </Target> 
    </Project> 

私はタスク出力のすべてが通常に見えますが、私のウェブサイトのルートにあるしかし結果web.configファイルが2つの変換ファイル内にあるものだけを含んでいると私はすべての通常のアプリケーションの構成設定を失うを実行します。..

誰でも何が起こっているか知っている?

答えて

1

私の問題は二重であることが判明しました。

  1. 私は唯一のダミーXDBをインストールし、データを報告するために使用されるが、実際にそれで、変換ツールのためのロジックの一部が含まれていたと思っSitecore.Foundation.Installerプロジェクトに密接に十分に見ていません。
  2. 基礎/機能レイヤーにいくつかの新しいプロジェクトを追加しました。デフォルトでは、「ビュープロパティ」を右クリックして「ビルドアクション」を「コンテンツ」に設定すると、デフォルトでweb.configファイルが生成されます最終的にWebルートディレクトリに公開される出力ディレクトリに置かれます。これは、 'None'と 'Output Directoryにコピー'を「Do not copy」に設定する必要があります。
関連する問題