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

Allow overriding MSBuildRuntimeType to "Full" on RUNTIME_TYPE_NETCORE #7481

Merged

Conversation

ccastanedaucf
Copy link
Contributor

Context

We have scenarios in internal build tools where MSBuild evaluation is executed in the parse phase under a .NET 6.0 process, prior the build phase which builds projects using full framework msbuild.exe. As evaluation results in the parse phase must match the build phase for prediction to be accurate, MSBuildRuntimeType must be set to "Full" in both cases - so we currently solve this by launching a separate process under full framework which runs evaluation / parsing and serializes results back to the main process.

However, this serialization incurs a significant amount of overhead on large repos. Instead, by having the option of forcing MSBuildRuntimeType=Full when on RUNTIME_TYPE_NETCORE, we would be able to evaluate these projects in-process for the majority of repos.

Changes Made

  • Added a new environment variable
    MsBuildForceEvaluateAsFullFramework
  • Added conditions to set MSBuildRuntimeType="Full" when this env var is set

Testing

Ran multiple validation runs across all repos on internal build tools to validate this approach works, comparing evaluation / parser results of the "forced" runtime vs "actual".

src/Build/Definition/Toolset.cs Outdated Show resolved Hide resolved
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.

LGTM, thanks!

@rainersigwald rainersigwald merged commit b06b55d into dotnet:main Mar 22, 2022
Forgind pushed a commit that referenced this pull request Apr 20, 2022
Fixes potential missing encoding errors during evaluation - this is already set at a few other points in the codebase, but can be missed when directly calling MSBuild libraries. Encountered this while testing #7481
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants