c# - app.config not getting transformed after installation of nuget package
问题描述
Please find attached app.config and app.config.install.xdt file content. Not able to find the cause of not transofming the file. The goal is to remove the added plugin under tag in app.config once my custom specflow package installation is complete. Is there any tool available where we can see the log(s) while install the nuget package and show wheather config file transformation is successful or fail? I already searched for other questions but no clue. Both the xml files are valid as I validat them from https://webconfigtransformationtester.apphb.com/.
app.config content
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/>
</configSections>
<log4net>
<appender name="FileAppender" type="log4net.Appender.FileAppender">
<appendToFile value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %P{Level}%4P{Source} - %message%newline"/>
</layout>
</appender>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%-5level] %message%newline"/>
</layout>
</appender>
<root>
<level value="DEBUG"/>
<appender-ref ref="FileAppender"/>
<appender-ref ref="ConsoleAppender"/>
</root>
</log4net>
<specFlow>
<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
<plugins>
<add name="Com.Plugin.Gherkin.SpecFlow.2.4" path="Com.Plugin.Gherkin.SpecFlow.2.4" type="Generator"/>
</plugins>
</specFlow>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
</startup>
</configuration>
app.config.install.xdt
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<specFlow>
<plugins>
<add xdt:Transform="Remove" />
</plugins>
</specFlow>
</configuration>
Package.nuspec
<?xml version="1.0"?>
<package >
<metadata>
<id>Sushil</id>
<version>1.0.0</version>
<authors>stade</authors>
<owners>stade</owners>
<licenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</licenseUrl>
<projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>
<iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Package description</description>
<releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
<copyright>Copyright 2019</copyright>
<tags>Tag1 Tag2</tags>
<dependencies>
<dependency id="SampleDependency" version="1.0" />
</dependencies>
</metadata>
<files>
<!--Add Section to Uninstall and Re-install Application.Config files-->
<file src="app.config.install.xdt" target="content" />
<file src="app.config.uninstall.xdt" target="content" />
</files>
</package>
解决方案
推荐阅读
- jdbc - 从 JetBrains JDBC 驱动程序执行 Drill 查询时引用错误
- c# - 从 DropDownList 值加载 TreeView C# ASP.NET
- .net-core - `dotMemoryUnit` 和 `dotnet test`
- c# - Microsoft SQL Server 和 Microsoft SQL Server Express 接口之间的区别
- java - 如何检查选择 1 在休眠 C3P0 中是否有效?
- swift - SwiftUI 如何在 VNDocumentCameraViewController 上添加覆盖?
- angular - 如何过滤垫扩展面板中的表格?按列
- prestashop - 在 prestashop 页面中插入 JS 脚本
- javascript - 使用可选参数对 Where 子句进行续集
- javascript - 如何在点击反应时将元素添加到数组中?