-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Ensure built-in and imported targets are respected by the solution pr… #1590
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2106,14 +2106,35 @@ public void IllegalUserTargetNamesDoNotThrow() | |
EndGlobal | ||
"); | ||
|
||
// "GetFrameworkPathAndRedistList" is for web projects only | ||
var illegalTargetNamesForCsproj = SolutionProjectGenerator._solutionGeneratedTargetNames.Union(new []{"ClassLibrary1"}).Except(new []{ "GetFrameworkPathAndRedistList" }).ToList(); | ||
ProjectInstance[] instances = SolutionProjectGenerator.Generate(solution, null, null, BuildEventContext.Invalid, null, illegalTargetNamesForCsproj); | ||
ProjectInstance[] instances; | ||
|
||
foreach (var illegalTargetName in illegalTargetNamesForCsproj) | ||
foreach (string builtInTargetName in new[] | ||
{ | ||
Assert.Equal(1, instances[0].Targets.Count(target => String.Compare(target.Value.Name, illegalTargetName, StringComparison.OrdinalIgnoreCase) == 0)); | ||
null, | ||
"Build", | ||
"Rebuild", | ||
"Clean", | ||
"Publish", | ||
"ClassLibrary1", | ||
"ClassLibrary1:Clean", | ||
"ClassLibrary1:Rebuild", | ||
"GetSolutionConfigurationContents", | ||
"ValidateProjects", | ||
}) | ||
{ | ||
instances = SolutionProjectGenerator.Generate(solution, null, null, BuildEventContext.Invalid, null, builtInTargetName == null ? null : new [] { builtInTargetName }); | ||
|
||
Assert.Equal(1, instances.Length); | ||
|
||
Assert.Equal(12, instances[0].TargetsCount); | ||
} | ||
|
||
|
||
instances = SolutionProjectGenerator.Generate(solution, null, null, BuildEventContext.Invalid, null, new[] { "Foo" }); | ||
|
||
Assert.Equal(1, instances.Length); | ||
|
||
Assert.Equal(14, instances[0].TargetsCount); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it was a late regression, I'd love to see an explicit test of the after.sln.targets scenario. Would that be prohibitively hard to produce? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay I added a test for this. |
||
} | ||
|
||
#region Helper Functions | ||
|
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.
Under what circumstances is this not redundant with the filtering you do here?
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.
If the project name contains a
.
or if you have two projects with the same name (like foo.csproj and foo.vbproj) then only this method knows what the final target names will be.I tried to explain that in the comment. Should I reword it so it makes more sense?