Web.Config
MS Build で変換済みファイルを出力できません。NuGet docsで説明されているように、NuGet パッケージの復元を使用してビルド プロジェクトをセットアップしました。変換を除いて、ビルドのすべての部分 (パッケージの復元、CI、Web デプロイ パッケージ) が機能します。ベースセットアップとカスタムプロジェクトファイル、および他の多くのオプションを試しましたが、どこにも行きませんでした.
問題なく以前に構成変換のセットアップを行ったことがあります。Slow Cheetah がインストールされており、現在の変換をプレビューして動作を確認できます。を介してローカルでビルドを実行するとMSBuild.exe
、実際に変換が行われます。
TransformWebConfigCore:
Transforming Source File: G:\MyProject\Web.config
Applying Transform File: G:\MyProject\Web.Debug.config
Output File: obj\Debug\TransformWebConfig\transformed\Web.config
Transformation succeeded
( -v の出力を見ると、個々の変換が実行されていることがわかります)
次に、Web Deploy は my をパラメーター化しますweb.config
。
Transformed Web.config using G:\MyProject\Web.Debug.config into obj\Debug\TransformWebConfig\transformed\Web.config.
PipelineTransformPhase:
Publish Pipeline Transform Phase
PreAutoParameterizationWebConfigConnectionStrings:
Creating directory "G:\MyProject\obj\Debug\CSAutoParameterize\transformed\Views\".
Copying obj\Debug\TransformWebConfig\transformed\Web.config to obj\Debug\CSAutoParameterize\original\Web.config.
AutoParameterizationWebConfigConnectionStringsCore:
Transforming Source File: G:\MyProject\Views\Web.config
Applying Transform File: <?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add
connectionString="{% token='$(ReplacableToken_#(parameter)_#(tokennumber))' xpathlocator='name' parameter='$(name)-Web.config Connection String' description='$(name) Connection String used in web.config by the application to access the database.' defaultValue='$(connectionString)' tags='SqlConnectionString' %}"
xdt:Transform="SetTokenizedAttributes(connectionString)" xdt:SupressWarnings="True" />
</connectionStrings>
</configuration>
No element in the source document matches '/configuration/connectionStrings'
Not executing SetTokenizedAttributes (transform line 6, 15)
Output File: obj\Debug\CSAutoParameterize\transformed\Views\Web.config
Transformation succeeded
PostAutoParameterizationWebConfigConnectionStrings:
Auto ConnectionString Transformed obj\Debug\TransformWebConfig\transformed\Web.config into obj\Debug\CSAutoParameterize\transformed\Web.config.
次に、パラメータ化されたファイルがパッケージに移動され、変換されたファイルが削除されます。
obj\Debug\CSAutoParameterize\transformed\Web.config を obj\Debug\Package\PackageTmp\Web.config にコピーします。ファイル「obj\Debug\CSAutoParameterize\transformed\Web.config」を削除しています。
web.config
そのため、ビルド出力に終わらない変換済みファイルがあります。変換は行われるのに、出力ディレクトリまたは Web デプロイ パッケージにコピーされないのはなぜですか?