简体   繁体   English

通过编程格式化Web.Config文件

[英]Formatting Web.Config File via programmatically

am installing my web app via installshield. 通过installshield安装我的Web应用程序。 from which am calling custom dll prepared with C# to modify the attributes in web.config file. 从中调用使用C#准备的自定义dll来修改web.config文件中的属性。

But the thing is after successful deploying my content to inetpub the web.config file looks bit ugly and distractive. 但是问题是,在将我的内容成功部署到inetpub之后,web.config文件看起来有点丑陋和分散注意力。

so can we run something like CTRL+K+D like we do in visual studio to make it looks well formatted? 那么我们可以像在Visual Studio中一样运行CTRL + K + D之类的东西来使其看起来格式正确吗?

i mean via programmatically formatting my web.config file. 我的意思是通过以编程方式格式化我的web.config文件。

Regards, Pavan 问候,帕万

You can use XmlTextWriter.Formatting property when writing the config. 编写配置时,可以使用XmlTextWriter.Formatting属性。 Please take a look at this post: Formatting XML in C# 请看一下这篇文章: 用C#格式化XML

This may be what you need. 这可能就是您所需要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM