hereのように動作するweb.config変換を取得しようとしています。私たちは他のプロジェクトでこのメソッドを使用しましたが、問題なく動作しますが、この新しいプロジェクトでは動作しません。web.template.xmlからのweb.configトランスフォームが動作しない
は、ここで私は、私はプロジェクト名が間違って得た場合にwpp.targetsファイルの名前を変更する成功
- せずにテストを試してみたものです。私は現在のものを知っています。なぜなら、この変換はweb.template.xmlからweb.configを再構築する唯一のものですからです。サブテンプレートのみが機能しません。 XDTで試してみました
- :ロケータ=「マッチ(名)」
- の.xml対.configをしようとした拡張、
- 設定マネージャがために「テスト」の設定を使用するように設定されている.XML、これは使用を働く私たちの他のプロジェクト私が取り組んでいるプロジェクト。
- web.template.Test.xmlがXDTがあります=私は
- web.template.xmlを交換したいセクションの「置き換え」Transformをプレースホルダ
- はwpp.targetsから「CopyWebTemplateConfig」セクションを削除しようとしています以下にリンクされているスタックの質問に示唆されているように。私たちの他のプロジェクトにはこれがあり、 "PropertyGroup"セクションがコメントアウトされています。私は両方の組み合わせを試しました。
私は上記のリンクとこの関連するスタックquestionを何度も読んだことがありますが、問題の内容を確認することはできません。
注パブリッシュ変換はある意味で機能します。 web.template.Test.xmlの値を含むweb.template.xmlファイルが作成されますが、wpp.targetsの指示に従ってweb.config.xmlは作成されません。これは、ビルドトランスフォームがうまく動作するようにすることで、より問題になります。
誰にも分からないことがありますか?
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の出力
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)
私にサンプルプロジェクトを送ってもらえませんか?私の電子メールはsayedha [at] {MicrosoftDOTcom}です。 –