Share via


Visual studio 2019 - space or not space before the closing tag

Question

Thursday, April 4, 2019 7:20 AM | 2 votes

I use VS 2019 to upgrade a project from .NET 4.6.2 to .NET 4.8. Visual Studio 2019, in its ultimate wisdom, decided that it wants to use a slightly different xml format. While they are the same functionally, this type of behavior causes a lot of unnecessary changes my commits, and is a source of more unnecessary changes in the future.

Is there any way to force Visual Studio to use a consistent markup style?

All replies (4)

Friday, April 5, 2019 8:50 AM

Hi ThuanNguy,

Welcome to the MSDN forum.

Could you please share the detail steps or sample solution? I tried to add a new web.config file and it seems when try to add the property, the space not auto add before the close tag, except the default one as below:

Meanwhile, there seems have no such option to remove the space before the close tag, sorry for this inconvenience.

Best regards,

Sara

MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


Friday, April 5, 2019 9:14 AM | 1 vote

You can reproduce by using the following steps:

1. Create a new .NET framework Web MVC project: check web.config

      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed"/>
        <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0"/>
      </dependentAssembly>

2. Open Nuget and update json to the latest version:

      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
      </dependentAssembly>

Notice the space. It seems either VS or Nuget randomly choose between the two styles.


Wednesday, April 10, 2019 9:38 AM

Hi ThuanNguy,

Thank you for your detail information and sorry for the delay reply.

According to your description, I can also reproduced this issue in VS 2017. We can go to Help-Send Feedback-Report a problem to report it the VS Product Team for better support. If you want us to help submit it, please feel free to let us know.

Best regards,

Sara

MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


Thursday, April 11, 2019 2:40 AM | 2 votes

Hi Sara,

Thank you. I reported it at https://developercommunity.visualstudio.com/content/problem/527913/assembly-bindings-added-by-vsnuget-inconsistently.html

Best Regards,

NDT.