Problem with formatting Nuget Config.Transform

I created a Nuget config transform file that has the following conversion:

<?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=" admin@mydomain.com " /> </identity> </endpoint> </client> </system.serviceModel> </configuration> 

The problem occurs when it is combined into an app.config application or a web.config file. Instead of being purely spaced, it combines everything into one line as follows:

  <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=" admin@mydomain.com " /> </identity></endpoint></client></system.serviceModel> 

This is not very readable for anyone using my package. Is there something I'm missing? Perhaps the right carriage?

+4
source share
1 answer

There are formatting restrictions in the original Web.config NuGet conversions. Starting with version 2.6, XDT transformations are added that do not have these restrictions. See the docs on how to use the .install.xdt and .uninstall.xdt files for any XML files in your package. As soon as I started using XDT, the formatting problems disappeared.

+4
source

Source: https://habr.com/ru/post/1494497/


All Articles