Преобразование web.config из web.template.xml не работает

Я пытаюсь заставить работать преобразования web.config, как описаноВот, Мы использовали этот метод в других проектах, и он работает без проблем, но не в этом новом проекте.

Вот то, что я пытался проверить безуспешно

Changing name of wpp.targets file in case I got the project name wrong. I know the current one I'm using works since it's the only one that causes web.config to be rebuilt from web.template.xml this transform works. Only the sub templates don't work. Tried with xdt:Locator="Match(name)" Tried .config extension vs .xml, our other projects where this works use .xml Configuration manager is set to use the "Test" configuration for the project I'm working on. web.template.Test.xml has xdt:Transform="Replace" for the section I want to replace web.template.xml has the placeholder Tried removing the "CopyWebTemplateConfig" section from wpp.targets as suggested on the stack question linked below. Our other projects have this and the "PropertyGroup" section commented out and I've tried both combinations.

Я прочитал вышеупомянутую ссылку несколько раз, и этот связанный стеквопрос, но не вижу, в чем проблема.

Note Трансформация публикации работает в некотором роде. Он создает файл web.template.xml, который содержит значения из web.template.Test.xml, но не создает файл web.config.xml, как указано в wpp.targets. Так что, похоже, проблема в том, чтобы заставить работать преобразование сборки.

Кто-нибудь имеет представление о том, чего не хватает?

wpp.targets

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <!-- Make sure web.config will be there even for package/publish -->
  <Target Name="CopyWebTemplateConfig" BeforeTargets="Build">
    <Copy SourceFiles="web.template.xml"
          DestinationFiles="web.config"/>
  </Target>

  <PropertyGroup>
    <PrepareForRunDependsOn>
      $(PrepareForRunDependsOn);
      UpdateWebConfigBeforeRun;
    </PrepareForRunDependsOn>
  </PropertyGroup>

  <!-- This target will run right before you run your app in Visual Studio -->
  <Target Name="UpdateWebConfigBeforeRun">
    <Message Text="Configuration: $(Configuration): Web.template.$(Configuration).xml"/>
    <TransformXml Source="web.template.xml"
              Transform="web.template.$(Configuration).xml"
              Destination="web.config" />
  </Target>

  <!-- Exclude the config template files from the created package -->
  <Target Name="ExcludeCustomConfigTransformFiles" BeforeTargets="ExcludeFilesFromPackage">
    <ItemGroup>
      <ExcludeFromPackageFiles Include="web.template.xml;web.template.*.xml"/>
    </ItemGroup>
    <Message Text="ExcludeFromPackageFiles: @(ExcludeFromPackageFiles)" Importance="high"/>
  </Target>
</Project>

web.template.xml

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=152368
  -->
<configuration>
  <configSections>           
    <sectionGroup name="TestSettings"></sectionGroup>
    ....
  </configSections>
    ....
  <TestSettings>
  </TestSettings>
   ....
</configuration>

web.template.Test.xml

<?xml version="1.0"?>
<!-- For more information on using transformations 
     see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <TestSettings xdt:Transform="Replace">
    ...
  </TestSettings>
</configuration>

MSBuild output

Target "UpdateWebConfigBeforeRun: (TargetId:143)" in file "C:\...\Project.wpp.targets" from project "C:\...\Project.csproj" (target "PrepareForRun" depends on it):
Task "Message" (TaskId:93)
  Configuration: Test: Web.template.Test.xml (TaskId:93)
Done executing task "Message". (TaskId:93)
Task "TransformXml" (TaskId:94)
  Transforming Source File: Web.template.xml (TaskId:94)
    Applying Transform File: Web.template.Test.xml (TaskId:94)
    Executing Replace (transform line 5, 18) (TaskId:94)
      on /configuration/TestSettings (TaskId:94)
      Applying to 'TestSettings' element (source line 121, 4) (TaskId:94)
      Replaced 'TestSettings' element (TaskId:94)
    Done executing Replace (TaskId:94)
    Output File: web.config (TaskId:94)
  Transformation succeeded (TaskId:94)
Done executing task "TransformXml". (TaskId:94)
Done building target "UpdateWebConfigBeforeRun" in project "Project.csproj".: (TargetId:143)

Ответы на вопрос(5)

Ваш ответ на вопрос