Skip to content

Conversation

@JoeRobich
Copy link
Member

@JoeRobich JoeRobich commented Jul 26, 2023

dotnet-format uses MSBuildWorkspace and needs to support the common .NET SDK scenarios, including WPF.

  • Adds the MSBuildWorkspace loader tests from dotnet/format
  • Adds the ability for the ProjectBuildManager to run targets when they are supported. Such as DesignTimeMarkupCompilation to support WPF scenarios.

Fixes dotnet/format#1402

@JoeRobich JoeRobich requested review from a team as code owners July 26, 2023 01:23
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 26, 2023
@JoeRobich
Copy link
Member Author

Thanks for the review @sharwell! I have updated with your suggestions.


var targets = new[] { TargetNames.Compile, TargetNames.CoreCompile };
var requiredTargets = new[] { TargetNames.Compile, TargetNames.CoreCompile };
var optionalTargets = new[] { TargetNames.DesignTimeMarkupCompilation };
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 It looks like if we set BuildingInsideVisualStudio to true, this will run automatically

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll merge in the changes from #57219 and close that one out.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, after testing locally, setting BuildingInsideVisualStudio breaks the blazor and blazorwasm scenarios. Will have to dig a bit to understand why.

Copy link
Member Author

Choose a reason for hiding this comment

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

@sharwell Setting BuildingInsideVisualStudio causes the RazorSourceGenerator.razorencconfig file to be added as an AnalyzerConfig, which then adds build_property.SuppressRazorSourceGenerator = true to the configuration. I noticed Roslyn's feature layer has a class dedicated to removing this config file from the Solution (https://github.com/dotnet/roslyn/blob/f5b6c715a742c56b7cc672e47385508fb4df98cc/src/Features/Core/Portable/Workspace/CompileTimeSolutionProvider.cs). I think we should take the change as is until Razor has sorted out their design time build.

Copy link
Member Author

Choose a reason for hiding this comment

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

@davidwengier Do you know the status of the Razor design time build work?

Copy link
Member

Choose a reason for hiding this comment

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

There won't be any change Razor design time code gen in the short term.
Additionally the last time someone tried to change whether BuildingInsideVisualStudio was set it broke dotnet watch and various VS Code things, from memory.

@JoeRobich JoeRobich force-pushed the dev/jorobich/msbuildworkspace-wpf-support branch from e437a14 to c3b7a08 Compare January 23, 2024 01:19
@JoeRobich JoeRobich force-pushed the dev/jorobich/msbuildworkspace-wpf-support branch from 0fe481c to 29ec1ac Compare February 9, 2024 03:05
@JoeRobich JoeRobich enabled auto-merge February 12, 2024 21:30
@JoeRobich JoeRobich disabled auto-merge February 12, 2024 21:50
@JoeRobich JoeRobich merged commit d8f4c5e into main Feb 12, 2024
@ghost ghost added this to the Next milestone Feb 12, 2024
@jjonescz jjonescz modified the milestones: Next, 17.10 P2 Feb 27, 2024
@JoeRobich JoeRobich deleted the dev/jorobich/msbuildworkspace-wpf-support branch May 7, 2024 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Template generated Projects fail to load cleanly

6 participants