On local debug configuration I want to logging in txt file. It's work. Logging to Azure Blob Storage work fine too. But I want configure the second to work only on "Azure debug" configuration.
I have created simple tranformation in web.debug.azure.config.
-> Web.config
<log4net debug="true">
<root>
<level value="Info" />
<appender-ref ref="Appender"/>
</root>
<appender name="Appender" type="log4net.Appender.RollingFileAppender" >
// Configuration stuff
</appender>
And it's set for "Debug" build configuration. While build for "Azure debug" I want to replace the "" with it: -> Web.Debug.Azure.config
<appender xdt:Transform="Replace" xdt:Locator="Match(name)" name="Appender" type="log4net.Appender.AzureAppendBlobAppender, log4net.Appender.Azure">
// Configuration stuff
</appender>
And when I do it. The first still working and the second no. Why? How to do it?
Unload the C# Project and modify the csproj file to add an AfterBuild Task, so your Web.Debug.Config transforms to Web.Azure.Debug.Config
Modify the Visual Studio version if required in the below import project path - Microsoft\\VisualStudio* v14.0 \\WebApplications\\Microsoft.WebApplication.targets*
Note : You might need to use Slow Cheetah or similar if you want to do this on a CI server if does not have Visual Studio instance as the project ships with Visual Studio.
<PropertyGroup>
<TransformInputFile>Web.config</TransformInputFile>
<TransformFile>Web.Debug.config</TransformFile>
<TransformOutputFile>Web.Debug.Azure.config</TransformOutputFile>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" />
<Target Name="AfterBuild">
<Message Text="=== Transform to Azure Debug ===" />
<TransformXml Source="$(TransformInputFile)" Transform="$(TransformFile)" Destination="$(TransformOutputFile)" />
</Target>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.