-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Cleanup usages of IsTestProject #49838
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
base: main
Are you sure you want to change the base?
Conversation
<Target Name="ValidateExecutableReferencesCore" | ||
DependsOnTargets="_CalculateIsVSTest;ValidateExecutableReferences" | ||
AfterTargets="_GetProjectReferenceTargetFrameworkProperties"> | ||
|
||
</Target> |
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.
Created this extra target without condition. The reason is I want to execute _CalculateIsVSTest
target unconditionally, because _CalculateIsVSTest
will set the property needed for the condition in ValidateExecutableReferences
.
@baronfel @dsplaisted This is green 🎉 |
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
Outdated
Show resolved
Hide resolved
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
Outdated
Show resolved
Hide resolved
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
Outdated
Show resolved
Hide resolved
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
Outdated
Show resolved
Hide resolved
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
Outdated
Show resolved
Hide resolved
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
Outdated
Show resolved
Hide resolved
@@ -115,7 +115,7 @@ Copyright (c) .NET Foundation. All rights reserved. | |||
<!-- Set the IsRidAgnostic property if this project should NOT accept global RuntimeIdentifier and SelfContained | |||
property values from referencing projects. --> | |||
<PropertyGroup Condition="'$(IsRidAgnostic)' == ''"> | |||
<IsRidAgnostic Condition="('$(_IsExecutable)' == 'true' And '$(IsTestProject)' != 'true') Or | |||
<IsRidAgnostic Condition="('$(_IsExecutable)' == 'true') Or |
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.
<IsRidAgnostic Condition="('$(_IsExecutable)' == 'true') Or | |
<IsRidAgnostic Condition="('$(_IsExecutable)' == 'true' And ('$(IsTestProject)' != 'true' Or '$(IsTestingPlatformApplication) != 'true')) Or |
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 would try to avoid reading IsTestingPlatformApplication
in evaluation if possible
@@ -1322,6 +1323,12 @@ Copyright (c) .NET Foundation. All rights reserved. | |||
UseAttributeForTargetFrameworkInfoPropertyNames="$(_UseAttributeForTargetFrameworkInfoPropertyNames)"/> | |||
</Target> | |||
|
|||
<Target Name="ValidateExecutableReferencesCore" |
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 think we can collapse _CalculateIsVSTestTestProject, ValidateExecutableReferencesCore, and ValidateExecutableReferences all into one target. Currently, ValidateExecutableReferences only has a single call to a task in it. So we can move the condition from the target to the task, and then move the _CalculateIsVSTestTestProject logic to set the properties into the ValidateExecutableReferences itself.
That seems a lot simpler and cleaner to me.
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 needed to add BeforeTargets="GetTargetFrameworksWithPlatformForSingleTargetFramework"
in _CalculateIsVSTestTestProject
. I'm not 100% sure if they can now be merged or not.
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 can still do a bit of simplification though. Let me try.
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.
Pushed a cleanup to get rid of ValidateExecutableReferencesCore
, but still keeping _CalculateIsVSTestTestProject
Fixes #49063