Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove xmlns from props/targets and UTs #7169

Merged
merged 2 commits into from
Jan 21, 2022
Merged

Conversation

dfederm
Copy link
Contributor

@dfederm dfederm commented Dec 22, 2021

xmlns hasn't been requires in project files for a while now (v15?), so this change removes it from all props/targets as well as all UTs (minus the ones explicitly testing the xmlns stuff).

@dfederm
Copy link
Contributor Author

dfederm commented Dec 22, 2021

FYI @Nirmal4G since you were interested in this

@Nirmal4G
Copy link
Contributor

Nirmal4G commented Dec 22, 2021

Nice... Upon reviewing, I see <?xml?> tags too. We can remove them too!

Contributes to #4779 and #6645

@Nirmal4G
Copy link
Contributor

Also, if it's not too much trouble, can you separate your changes into specific commits. Like separate the formatting and xmlns removals (even this can be further separated into removals in shipping files, project files, docs and unit tests).

Totally optional but it's just good practice.

Copy link
Member

@Forgind Forgind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not going to pretend I legitimately reviewed this, but the part I did review looked good! xmlns and ToolsVersion confused me before I learned that I can pretty much ignore them.

@@ -82,7 +82,7 @@ public void XmlLocationsAreCached()
public void LocationStringsMedley()
{
string content = @"
<Project ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`http://schemas.microsoft.com/developer/msbuild/2003`>
<Project ToolsVersion=`msbuilddefaulttoolsversion`>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also remove the ToolsVersion, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, although I figured this PR was large enough as it was, so probably will follow up with another PR.

@dfederm
Copy link
Contributor Author

dfederm commented Dec 22, 2021

Also, if it's not too much trouble, can you separate your changes into specific commits. Like separate the formatting and xmlns removals (even this can be further separated into removals in shipping files, project files, docs and unit tests).

Totally optional but it's just good practice.

The formatting was automatic by vscoed and unintentional :(. But figured I'd leave them in place. I should look into turning that off by default...

@Nirmal4G
Copy link
Contributor

No problem. It's good that you format the files that is touched but bad that every change is in a single commit, that's all!

Copy link
Contributor

@Nirmal4G Nirmal4G left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a long time but it's looking good! 👌

@@ -268,13 +268,13 @@ public void ExcessivelyNestedChoose()
public void SettingWhenConditionDirties()
{
string content = @"
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003' >
<Project>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Make sure to verify there is still adequate coverage for cases where xmlns is included, since both approaches are supported

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I left it in a bunch of UTs, mostly ones which dealt with evaluation. It probably could be cleaned from even more UTs (many use xmlns="msbuildnamespace" instead of xmlns="http://schemas.microsoft.com/developer/msbuild/2003">), but whatever this change is large enough as-is.

Comparing repo-wide searches of "xmlns=" (which admittedly covers other namespaces eg in loc xml files):
Before: 2641 results in 377 files
After: 1693 results in 277 files

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also had me worried but by inspection it looks ok (this concern is why I split out the "remove from unit tests" part of the change).

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="dogfood" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is dogfood relevant here? it's deprecated so...meh

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do deprecated unit tests even run? Like ever? Should we just delete this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they don't at the moment but I hate to delete them because we should turn them back on (but maybe we can just delete the code first?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More than happy to delete deprecated UTs if that's the decision. But for another PR, as this one is big enough :)

Copy link
Member

@benvillalobos benvillalobos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked everything but the .cs files and it looks fine, minus my 1 question on compat. If we won't have any compat issues, I approve.

@@ -10,7 +10,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't break compatibility with some super old MSBuild that's still in support will it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with #7165, the assertion is that these targets are never used with a super-old MSBuild.

I left it in a bunch of UTs, mostly ones which dealt with evaluation. It probably could be cleaned from even more UTs (many use `xmlns="msbuildnamespace"` instead of `xmlns="http://schemas.microsoft.com/developer/msbuild/2003">`), but whatever this change is large enough as-is.

Comparing repo-wide searches of "xmlns=" (which admittedly covers other namespaces eg in loc xml files):
Before: 2641 results in 377 files
After: 1693 results in 277 files
@rainersigwald
Copy link
Member

I just pushed a change that a) splits into two commits, one for "MSBuild logic in/shipped from this repo" and one for tests, and b) drops the changes in Deprecated.

@Forgind Forgind added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label Jan 19, 2022
@ladipro ladipro merged commit 8872ed6 into dotnet:main Jan 21, 2022
@dfederm dfederm deleted the remove-xmlns branch July 29, 2022 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants