0
我有一個NLog.config文件,我想在發佈我的網站之前進行轉換。類似於web.config的轉換方式。我該如何做到這一點?我無法找到如何做到這一點的可靠資源。NLog.config轉換
我嘗試添加變換到的csproj
<Target Name="BeforeBuild" Condition="exists('NLog.$(Configuration).config')">
<Message Text="Tranforming NLog..."/>
<TransformXml Source="NLog.config" Transform="NLog.$(Configuration).config" Destination="$(OutputPath)\NLog.config" />
</Target>
還添加了NLOG到的csproj:
<Content Include="NLog.config">
<SubType>Designer</SubType>
</Content>
<None Include="NLog.aws-prod.config">
<DependentUpon>NLog.config</DependentUpon>
</None>
<None Include="NLog.aws-test.config">
<DependentUpon>NLog.config</DependentUpon>
</None>
但這並不變換NLog.config複製到包目錄(或部署到AWS時)。原始的NLog.config被複制,並且也存放在/ bin目錄中。
查找到SlowCheetah - https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.SlowCheetah-XMLTransforms – JAZ
你可以將這個配置你構建項目之後,但你會發布它們之前? –
謝謝你,約翰,指出我在正確的方向。我模仿SlowCheetah完成的更改並手動編輯我的csproj。下面將添加解決方案 – Dan