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
Toolset configuration net5.0 #6220
Merged
benvillalobos
merged 20 commits into
dotnet:master
from
minglunli:toolsetConfigurationNet5
Mar 11, 2021
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
d3e8516
ToolsetConfigurationReader compilable with net5.0
minglunli d9a316d
Allow some unit tests to run in net5.0
minglunli 046e0a6
Remove System.Configuration Reference completed
minglunli 9a541e4
Allow IntrinsicFunctions to run in all conditions
minglunli d0d0e7e
Open up Registry as well
minglunli f3d2d22
Removing all FEATURE_SYSTEM_CONFIGURATION that aren't needed
minglunli 82a23fc
Adding unit tests
minglunli 7570c02
ToolsetConfigurationReader compilable with net5.0
minglunli ab9d9ed
Allow some unit tests to run in net5.0
minglunli 8ec091f
Remove System.Configuration Reference completed
minglunli b9d7dba
Allow IntrinsicFunctions to run in all conditions
minglunli f2e10bd
Open up Registry as well
minglunli 4b1343b
Removing all FEATURE_SYSTEM_CONFIGURATION that aren't needed
minglunli 1616a36
Adding unit tests
minglunli fd7a68f
Merge branch 'toolsetConfigurationNet5' of github.com:minglunli/msbui…
minglunli da88865
Fixing whitespaces
minglunli dbc1236
Fixing comment and more whitespace
minglunli 7e4ab72
Unit test + package version update
minglunli a5d1939
Addressing PR comments
minglunli 6989bc1
Fix BOM change
minglunli File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 81 additions & 42 deletions
123
src/Build.UnitTests/Evaluation/ImportFromMSBuildExtensionsPath_Tests.cs
Large diffs are not rendered by default.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
src/Build.UnitTests/Evaluation/ToolsetConfigurationNet5_Tests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
#if !FEATURE_SYSTEM_CONFIGURATION | ||
/* This test is designed especially to test Configuration parsing in net5.0 | ||
* which means it WON'T work in net472 and thus we don't run it in net472 */ | ||
|
||
using Microsoft.Build.Evaluation; | ||
using Microsoft.Build.Execution; | ||
|
||
using Xunit; | ||
using System.Collections.Generic; | ||
using Shouldly; | ||
|
||
namespace Microsoft.Build.UnitTests.Evaluation | ||
{ | ||
/// <summary> | ||
/// Unit tests for MSBuild Net5.0 Configuration Parsing | ||
/// </summary> | ||
public class ToolsetConfigurationNet5Test | ||
{ | ||
[Fact] | ||
// The default ToolsetDefintionLocations is None, which results in only the local which results in only the several included | ||
// paths such as SDK path and RoslynTargetPath and nothing else. This behavior is expected and the exact same as before. | ||
public void ToolsetDefinitionLocationsIsDefault() | ||
{ | ||
var projectCollection = new ProjectCollection(); | ||
IDictionary<string, string> toolsetProperties | ||
= new Dictionary<string, string>(); | ||
|
||
foreach (Toolset toolset in projectCollection.Toolsets) | ||
{ | ||
foreach (KeyValuePair<string, ProjectPropertyInstance> properties in toolset.Properties) | ||
{ | ||
toolsetProperties[properties.Value.Name] = properties.Value.EvaluatedValue; | ||
} | ||
} | ||
|
||
toolsetProperties.ShouldContainKey("MSBuildSDKsPath"); | ||
toolsetProperties.ShouldContainKey("RoslynTargetsPath"); | ||
toolsetProperties["MSBuildSDKsPath"].ShouldNotBeNullOrEmpty(); | ||
toolsetProperties["RoslynTargetsPath"].ShouldNotBeNullOrEmpty(); | ||
|
||
toolsetProperties.ShouldNotContainKey("VCTargetsPath"); | ||
toolsetProperties.ShouldNotContainKey("MSBuildToolsRoot"); | ||
toolsetProperties.ShouldNotContainKey("MSBuildExtensionsPath"); | ||
} | ||
|
||
[Fact] | ||
// With ToolsetDefintionLocations set to ConfigurationFile (Which would only happen in net5.0 if the user decides to set it). | ||
// Most toolsets are available and the MsBuildTools and SDK paths are all in the net5.0 runtime. | ||
public void ToolsetDefinitionLocationsIsConfiguration() | ||
{ | ||
var projectCollection = new ProjectCollection(ToolsetDefinitionLocations.ConfigurationFile); | ||
IDictionary<string, string> toolsetProperties | ||
= new Dictionary<string, string>(); | ||
|
||
foreach (Toolset toolset in projectCollection.Toolsets) | ||
{ | ||
foreach (KeyValuePair<string, ProjectPropertyInstance> properties in toolset.Properties) | ||
{ | ||
toolsetProperties[properties.Value.Name] = properties.Value.EvaluatedValue; | ||
} | ||
} | ||
|
||
toolsetProperties.ShouldContainKey("MSBuildSDKsPath"); | ||
toolsetProperties.ShouldContainKey("RoslynTargetsPath"); | ||
toolsetProperties["MSBuildSDKsPath"].ShouldNotBeNullOrEmpty(); | ||
toolsetProperties["RoslynTargetsPath"].ShouldNotBeNullOrEmpty(); | ||
|
||
toolsetProperties.ShouldContainKey("VCTargetsPath"); | ||
toolsetProperties.ShouldContainKey("MSBuildToolsRoot"); | ||
toolsetProperties.ShouldContainKey("MSBuildExtensionsPath"); | ||
toolsetProperties["VCTargetsPath"].ShouldNotBeNullOrEmpty(); | ||
toolsetProperties["MSBuildToolsRoot"].ShouldNotBeNullOrEmpty(); | ||
toolsetProperties["MSBuildExtensionsPath"].ShouldNotBeNullOrEmpty(); | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we own this? Also thinking we should try running this through RPS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this is my first time making a PR in MSBuild so I'm not familiar with the process. Mihai created an exp/* branch for me here and it triggered an VS insertion and that passed. Is that RPS or do we need to run something else for it?
And I do think we own the package as shown here. The package is owned by Microsoft and dotnetframework.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! That is what I was thinking of with RPS. It failed symbol check, but I'm assuming that was innocuous.
I should have clarified that I was wondering if MSBuild owns S.C.CM. I hit a problem at one point when MSBuild updated a package that Roslyn owned, and we had mismatching versions with them. I think that sort of problem would have been caught by RPS, so I think this is good? But I don't feel very confident about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following up to our convo this morning: I talked to @cdmihai and he's not sure about who owns this package exactly either, but believes it should be fine since it is not referenced in VS's config.corext.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found AssemblyVersions.tt, and it isn't referenced there either.