我创建了一个Nuget 配置转换文件 http://docs.nuget.org/docs/creating-packages/configuration-file-and-source-code-transformations具有以下变换:
<?xml version="1.0">
<configuration>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IMyService" />
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://mydomain/MySvc/MySvc.svc"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IMyService"
contract="MyNamespace.MyService" name="NetTcpBinding_IMyService">
<identity>
<userPrincipalName value="[email protected] /cdn-cgi/l/email-protection" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
当它合并到应用程序的 app.config 或 web.config 文件中时,就会出现问题。它不是整齐地间隔,而是将所有内容连接成一行,如下所示:
<system.serviceModel><bindings><netTcpBinding><binding name="NetTcpBinding_IMyService" /></netTcpBinding></bindings><client><endpoint address="net.tcp://mydomain/MySvc/MySvc.svc" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IMyService" contract="MyNamespace.MyService" name="NetTcpBinding_IMyService"><identity><userPrincipalName value="[email protected] /cdn-cgi/l/email-protection" /> </identity></endpoint></client></system.serviceModel>
对于那些使用我的包的人来说,这不太可读。我有什么遗漏的吗?也许正确的回车?
NuGet 的原始 Web.config 转换存在格式限制。从 v2.6 开始,添加了 XDT 转换,它没有这些限制。请参阅docs http://docs.nuget.org/docs/creating-packages/configuration-file-and-source-code-transformations关于如何使用.install.xdt
and .uninstall.xdt
文件用于包中的任何 XML 文件。一旦我开始使用 XDT,格式问题就消失了。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)