Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当为服务引用自动生成XML时,如何阻止Visual Studio换行_Xml_Visual Studio_Wcf_Web Services_Formatting - Fatal编程技术网

当为服务引用自动生成XML时,如何阻止Visual Studio换行

当为服务引用自动生成XML时,如何阻止Visual Studio换行,xml,visual-studio,wcf,web-services,formatting,Xml,Visual Studio,Wcf,Web Services,Formatting,在Visual Studio项目中添加或更新服务引用(以前称为“Web引用”)时,VS.NET将自动生成应用程序配置中的所有XML绑定代码 它看起来像这样: <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IUserService" closeTimeout="00:01:00" openTime

在Visual Studio项目中添加或更新服务引用(以前称为“Web引用”)时,VS.NET将自动生成应用程序配置中的所有XML绑定代码

它看起来像这样:

<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <binding name="BasicHttpBinding_IUserService" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferSize="6553600" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600"
        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        <security mode="None">
          <transport clientCredentialType="None" proxyCredentialType="None"
            realm="" />
          <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
  <client>
    <endpoint address="http://domain.com/services/user.svc"
      binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserService"
      contract="UserService.IUserService" name="BasicHttpBinding_IUserService" />
  </client>
</system.serviceModel>
<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <binding name="BasicHttpBinding_IUserService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="6553600" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        <security mode="None">
          <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
          <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
  <client>
    <endpoint address="http://domain.com/services/user.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserService" contract="UserService.IUserService" name="BasicHttpBinding_IUserService" />
  </client>
</system.serviceModel>

我讨厌它看起来有多凌乱,所以我通常会通过手动“修复”它来删除所有的换行符

所以我让它看起来像这样:

<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <binding name="BasicHttpBinding_IUserService" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferSize="6553600" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600"
        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        <security mode="None">
          <transport clientCredentialType="None" proxyCredentialType="None"
            realm="" />
          <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
  <client>
    <endpoint address="http://domain.com/services/user.svc"
      binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserService"
      contract="UserService.IUserService" name="BasicHttpBinding_IUserService" />
  </client>
</system.serviceModel>
<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <binding name="BasicHttpBinding_IUserService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="6553600" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        <security mode="None">
          <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
          <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
  <client>
    <endpoint address="http://domain.com/services/user.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserService" contract="UserService.IUserService" name="BasicHttpBinding_IUserService" />
  </client>
</system.serviceModel>

这不仅仅是希望它看起来干净的问题。我的一些客户端项目有超过20个引用,因此它有助于防止配置没有10英尺的垂直滚动


我一直在寻找可以阻止这种情况的方法,但从未找到任何方法。今天早上,我突然想到也许我应该问一下。其他的问题,涉及到类似的问题,但还没有解决办法。

我很肯定你能做到这一点。在Option/Text Editor/XML下,应该有一个名为属性间距的设置。我有完全相反的设置。在那里,展开换行设置并查看该设置。

我很确定您可以做到这一点。在Option/Text Editor/XML下,应该有一个名为属性间距的设置。我有完全相反的设置。此时,展开换行设置并查看该设置。

取消选中“工具”>“选项”>“XML>格式”中的“自动格式”选项可能会有所帮助

取消选中工具>选项>XML>格式中的自动格式选项可能会有所帮助

我看到的只是一个“Word Wrap”选项,该选项已被取消选中。。哦,哼,它所做的只是保留现有的格式。它不会为您重新设置格式。是时候写一个宏了。我看到的只是一个已经取消选中的“Word Wrap”选项。。哦,哼,它所做的只是保留现有的格式。它不会为您重新设置格式。是时候写宏了。