dotnet / dotnet/msbuild

Design-time builds in CPS are doing too much work because BuildingProject is set to true

Open
#2,417 5 comments 1 reaction 0 assignees View on GitHub
Area: Performance Priority:2 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

To reduce build times, CPS groups build targets for a project together. This has the unintended side-effect of turning `$(BuildingProject)` on during lots of CPS design-time builds.

Lots of behavior in common targets is driven by `$(BuildingProject)`, it's basically the legacy equivalent of `$(DesignTimeBuild)` != 'true'":

```
186>------ Build started: Project: Microsoft.VisualStudio.ProjectSystem.Managed, Targets: CollectResolvedSDKReferencesDesignTime, DebugSymbolsProjectOutputGroup, CollectPackageReferences, ResolveComReferencesDesignTime, ContentFilesProjectOutputGroup, DocumentationProjectOutputGroupDependencies, SGenFilesOutputGroup, ResolveProjectReferencesDesignTime, SourceFilesProjectOutputGroup, DebugSymbolsProjectOutputGroupDependencies, SatelliteDllsProjectOutputGroup, BuiltProjectOutputGroup, SGenFilesOutputGroupDependencies, ResolveAssemblyReferencesDesignTime, CollectAnalyzersDesignTime, CollectSDKReferencesDesignTime, DocumentationProjectOutputGroup, PriFilesOutputGroup, BuiltProjectOutputGroupDependencies, ResolvePackageDependenciesDesignTime, SatelliteDllsProjectOutputGroupDependencies, SDKRedistOutputGroup, CompileDesignTime, CollectResolvedCompilationReferencesDesignTime ------

...

186>Target "BuildOnlySettings" in file "C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets":
186> Set Property: BuildingProject=true
```

`BuildOnlySettings` is basically a dependency of most of the output groups targets.

Things that I'm seeing we're doing:

- ResolveAssemblyReferences; FindDependencies, FindSatellites, FindSerializationAssemblies, FindRelatedFiles is all true.
- ResolveAssemblyReferences; Silent is false - undecided if this is good or bad.

This would explain why ResolveAssemblyReferences is showing up on traces, FindDependencies is very slow.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.