Skip to content

Conversation

@jjonescz
Copy link
Member

@jjonescz jjonescz commented Oct 29, 2025

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2615118.
Validation: https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/684436 (the remaining failures seem to be because some parts of VS build set also ToolPath to a compiler that doesn't support the new core compiler option /sdkpath - I will investigate if those can be fixed at the VS side - anyway those failures are not blocking as they won't appear until the workaround <RoslynCompilerType>Framework</RosynCompilerType> is reverted on the VS side - I did that only in this validation PR)

/// hence we also compare <see cref="ToolTask.ToolExe"/> with <see cref="AppHostToolName"/> in addition to <see cref="ToolName"/>.
/// </remarks>
protected bool UsingBuiltinTool => string.IsNullOrEmpty(ToolPath) && ToolExe == ToolName;
protected bool UsingBuiltinTool => string.IsNullOrEmpty(ToolPath) && (ToolExe == ToolName || ToolExe == AppHostToolName);
Copy link
Member

Choose a reason for hiding this comment

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

I would just check against AppHostToolName only. Not sure there is vale in supporting CscToolExe comparing to csc.dll.

Copy link
Member Author

@jjonescz jjonescz Oct 29, 2025

Choose a reason for hiding this comment

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

That's what I had before I realized it doesn't work. If ToolExe is not overridden by a customer, it is equal to ToolName (e.g., csc.dll) and so ToolExe == AppHostToolName is false, which would lead to UsingBuiltinTool being false which is wrong. There are tests for that.

Copy link
Member Author

@jjonescz jjonescz Oct 29, 2025

Choose a reason for hiding this comment

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

You're right it also means we now support a scenario where customer explicitly sets ToolExe = "csc.dll" (but only if apphost is disabled) but I don't see a simple way around that.

@jjonescz jjonescz marked this pull request as ready for review October 30, 2025 09:51
@jjonescz jjonescz requested a review from a team as a code owner October 30, 2025 09:51
@jjonescz jjonescz marked this pull request as draft October 30, 2025 09:52
@jjonescz jjonescz marked this pull request as ready for review October 30, 2025 18:26
@jjonescz
Copy link
Member Author

@jaredpar @RikkiGibson @333fred for reviews, thanks

else
{
Assert.Contains("csc.dll", result.Output);
Assert.DoesNotContain("csc.exe", result.Output);
Copy link
Member

Choose a reason for hiding this comment

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

Should this be ExeExtension? Or do we need a regex to say that csc isn't matched, start/end word boundaries around it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added ExeExtension and a trailing space to check for word boundary (regex would be more complicated since we would technically need to escape the pattern so . doesn't match everything...), thanks

@jjonescz jjonescz requested review from 333fred and jaredpar November 5, 2025 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants