My C# Solution is taking longer to compile that I would like.
Is there a way to profile the build process to see what is taking so long?
My C# Solution is taking longer to compile that I would like.
Is there a way to profile the build process to see what is taking so long?
One trick you can use is to create multiple build configurations so you can build projects selectively, only building what changes rather than the whole solution every time.
There's already a profiler built into MSBuild. Tools + Options, Projects and Solutions, Build and Run, "MSBuild project build output verbosity". Change it to Diagnostic.
Sample output from a do-nothing project:
Project Performance Summary:
400 ms C:\Users\hpassant\AppData\Local\Temporary Projects\WindowsFormsApplication3\WindowsFormsApplication3.csproj 1 calls
400 ms Rebuild 1 calls
Target Performance Summary:
0 ms CreateSatelliteAssemblies 1 calls
0 ms ResolveReferences 1 calls
0 ms _CheckForInvalidConfigurationAndPlatform 1 calls
0 ms _SetTargetFrameworkMonikerAttribute 1 calls
0 ms ResGen 1 calls
0 ms BeforeResGen 1 calls
0 ms GetReferenceAssemblyPaths 1 calls
0 ms AfterCompile 1 calls
0 ms PrepareResources 1 calls
0 ms AfterCompileWinFX 1 calls
0 ms AfterResGen 1 calls
0 ms _ComputeNonExistentFileProperty 1 calls
0 ms BeforeClean 1 calls
0 ms Build 1 calls
0 ms GetTargetPath 1 calls
0 ms GetFrameworkPaths 1 calls
0 ms CompileRdlFiles 1 calls
0 ms AfterMarkupCompilePass1 1 calls
0 ms AfterResolveReferences 1 calls
0 ms BeforeBuild 1 calls
0 ms _CopySourceItemsToOutputDirectory 1 calls
0 ms _AfterCompileWinFXInternal 1 calls
0 ms CleanPublishFolder 1 calls
0 ms Clean 1 calls
0 ms CreateCustomManifestResourceNames 1 calls
0 ms PrepareResourceNames 1 calls
0 ms AfterRebuild 1 calls
0 ms PrepareRdlFiles 1 calls
0 ms CleanReferencedProjects 1 calls
0 ms ComputeIntermediateSatelliteAssemblies 1 calls
0 ms AfterClean 1 calls
0 ms BuildOnlySettings 1 calls
0 ms BeforeCompile 1 calls
0 ms SetWin32ManifestProperties 1 calls
0 ms FileClassification 1 calls
0 ms BeforeResolveReferences 1 calls
0 ms PrepareForRun 1 calls
0 ms DesignTimeMarkupCompilation 1 calls
0 ms CoreBuild 1 calls
0 ms Rebuild 1 calls
0 ms Compile 1 calls
0 ms GenerateTargetFrameworkMonikerAttribute 1 calls
0 ms AfterBuild 1 calls
0 ms _SplitProjectReferencesByFileExistence 1 calls
1 ms SplitResourcesByCulture 1 calls
1 ms GetCopyToOutputDirectoryItems 1 calls
1 ms _CheckForCompileOutputs 1 calls
1 ms _GenerateCompileInputs 1 calls
1 ms DesignTimeXamlMarkupCompilation 1 calls
1 ms PrepareForBuild 1 calls
1 ms _GenerateSatelliteAssemblyInputs 1 calls
1 ms CreateManifestResourceNames 1 calls
1 ms _SetEmbeddedWin32ManifestProperties 1 calls
1 ms BeforeRebuild 1 calls
1 ms ResolveProjectReferences 1 calls
1 ms IncrementalClean 1 calls
2 ms _CleanGetCurrentAndPriorFileWrites 1 calls
5 ms CopyFilesToOutputDirectory 1 calls
6 ms ResolveAssemblyReferences 1 calls
7 ms AssignTargetPaths 1 calls
13 ms CoreResGen 1 calls
54 ms CoreClean 1 calls
298 ms CoreCompile 1 calls
Task Performance Summary:
0 ms GetFrameworkPath 1 calls
0 ms ReadLinesFromFile 2 calls
0 ms ConvertToAbsolutePath 1 calls
0 ms RemoveDuplicates 3 calls
0 ms AssignCulture 1 calls
0 ms CreateCSharpManifestResourceName 1 calls
0 ms MakeDir 2 calls
1 ms FindAppConfigFile 1 calls
1 ms FindUnderPath 7 calls
1 ms Message 3 calls
2 ms WriteLinesToFile 2 calls
4 ms Copy 2 calls
5 ms ResolveAssemblyReference 1 calls
6 ms AssignTargetPath 5 calls
12 ms GenerateResource 1 calls
51 ms Delete 3 calls
298 ms Csc 1 calls