0
NLog.configはプロダクション用に別のデータベースを指定する必要があります。 this ツールを使用しています。 私のNLog.Configの一部です。web config以外のファイルを変換するreplace要素
<?xml version="1.0" encoding="utf-8"?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="ExceptionLog" type="Database">
<connectionString>
---- Db Connection string for test-------
</connectionString>
プロダクショントランスフォームを作成しましたが、ファイルを変換できません。ここで
は、我々は属性ではなく、全体の要素を変更する必要があり、私は
<?xml version="1.0"?>
<!-- For more information on using app.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<parameters value="Db connection for prod"
xdt:Transform="Replace" xdt:Locator="XPath(targets/target/connectionString)" />
</configuration>
を持っているものです。
を、どのように私は2番目の文字列を置換します? – SJMan
'XPath(/ nlog:nlog/nlog:targets/nlog:target [@ name = 'ExceptionLog']/nlog:connectionString)'の属性マッチングを使用してターゲットを指定し、別の "Replace"を '@ name = DebugLogs' 。 – Gedrox