I fixed a few issues that cause project rebuilds, mainly in C#/C++ projects (change copy always to copy if newer, remove references to missing files, etc). I did it by changing the MSBuild output to Diagnostic and analysing the output.
But I failed to apply the same workarounds for very simple FSharp projects which are in the solution. Output does not show anything suspicious for me. The project itself is a one-file project.
Minimal output:
1>------ Build started: Project: FSharpProject, Configuration: Debug Any CPU ------
1> "C:\Project\Source\.nuget\NuGet.exe" install "C:\Project\Source\FSharpProject\packages.config" -source "" -NonInteractive -RequireConsent -solutionDir "C:\Project\Source\ "
1> All packages listed in packages.config are already installed.
1> FSharpProject -> C:\Project\Source\FSharpProject\bin\Debug\FSharpProject.dll
2>------ Build started: Project: FSharpProject.Tests, Configuration: Debug Any CPU ------
2> "C:\Project\Source\.nuget\NuGet.exe" install "C:\Project\Source\FSharpProject.Tests\packages.config" -source "" -NonInteractive -RequireConsent -solutionDir "C:\Project\Source\ "
2> All packages listed in packages.config are already installed.
2> FSharpProject.Tests -> C:\Project\Source\FSharpProject.Tests\bin\Debug\FSharpProject.Tests.dll
========== Build: 2 succeeded, 0 failed, 16 up-to-date, 0 skipped ==========
Diagnostic output is HUGE, but it looks like it does not show rebuild reasons.
Update:
I've created a simple solution with two projects: C# and F#.
While C# project is reported up-to-date, the build action is executed for the F# project all the time. Is it just normal behaviour for the F# projects?
1>------ Build started: Project: FSharpProject, Configuration: Debug Any CPU ------
1>Target "_CheckForInvalidConfigurationAndPlatform" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (entry point):
1>Target "BeforeBuild" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "Build" depends on it):
1>Target "BuildOnlySettings" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CoreBuild" depends on it):
1>Target "GetFrameworkPaths" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.NetFramework.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "PrepareForBuild" depends on it):
1>Target "GetReferenceAssemblyPaths" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "PrepareForBuild" depends on it):
1>Target "PrepareForBuild" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CoreBuild" depends on it):
1>Target "BeforeResolveReferences" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "ResolveReferences" depends on it):
1>Target "AssignProjectConfiguration" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "ResolveReferences" depends on it):
1>Target "_SplitProjectReferencesByFileExistence" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "ResolveProjectReferences" depends on it):
1>Target "ResolveProjectReferences" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "ResolveReferences" depends on it):
1>Target "GetInstalledSDKLocations" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "ResolveSDKReferences" depends on it):
1>Target "ResolveSDKReferences" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "ResolveAssemblyReferences" depends on it):
1>Target "ExpandSDKReferences" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "ResolveAssemblyReferences" depends on it):
1>Target "ResolveAssemblyReferences" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "ResolveReferences" depends on it):
1>Target "AfterResolveReferences" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "ResolveReferences" depends on it):
1>Target "ImplicitlyExpandDesignTimeFacades" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.NetFramework.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "ResolveReferences" depends on it):
1>Target "ResolveReferences" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CoreBuild" depends on it):
1>Target "ValidationExtension" in file "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.WorkflowBuildExtensions.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "PrepareResources" depends on it):
1>Target "ExpressionBuildExtension" in file "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.WorkflowBuildExtensions.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "PrepareResources" depends on it):
1>Target "AfterMarkupCompilePass1" in file "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "PrepareResources" depends on it):
1>Target "FileClassification" in file "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "PrepareResources" depends on it):
1>Target "AssignTargetPaths" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "PrepareResourceNames" depends on it):
1>Target "SplitResourcesByCulture" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "PrepareResourceNames" depends on it):
1>Target "CreateCustomManifestResourceNames" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "PrepareResourceNames" depends on it):
1>Target "PrepareResourceNames" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "PrepareResources" depends on it):
1>Target "BeforeResGen" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "ResGen" depends on it):
1>Target "CoreResGen" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "ResGen" depends on it):
1>Target "AfterResGen" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "ResGen" depends on it):
1>Target "ResGen" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "PrepareResources" depends on it):
1>Target "PrepareRdlFiles" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\ReportingServices\Microsoft.ReportingServices.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CompileRdlFiles" depends on it):
1>Target "CompileRdlFiles" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\ReportingServices\Microsoft.ReportingServices.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "PrepareResources" depends on it):
1>Target "PrepareResources" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CoreBuild" depends on it):
1>Target "_SetEmbeddedWin32ManifestProperties" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "SetWin32ManifestProperties" depends on it):
1>Target "SetWin32ManifestProperties" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "Compile" depends on it):
1>Target "_GenerateCompileInputs" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "Compile" depends on it):
1>Target "GenerateTargetFrameworkMonikerAttribute" in file "C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "BeforeCompile" depends on it):
1> Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1>Target "BeforeCompile" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "Compile" depends on it):
1>Target "DesignTimeXamlMarkupCompilation" in file "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Xaml.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CoreCompile" depends on it):
1>Target "DesignTimeMarkupCompilation" in file "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CoreCompile" depends on it):
1>Target "CoreCompile" in file "C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "Compile" depends on it):
1> Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
1>Target "AfterCompile" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "Compile" depends on it):
1>Target "SetBuildInfoDefaults" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\BuildInfo\Microsoft.VisualStudio.ReleaseManagement.BuildInfo.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "DeleteBuildInfoFile" depends on it):
1>Target "DeleteBuildInfoFile" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\BuildInfo\Microsoft.VisualStudio.ReleaseManagement.BuildInfo.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "Compile" depends on it):
1>Target "DeleteBuildInfoResource" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\BuildInfo\Microsoft.VisualStudio.ReleaseManagement.BuildInfo.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "Compile" depends on it):
1>Target "AfterCompileWinFX" in file "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "_AfterCompileWinFXInternal" depends on it):
1>Target "_AfterCompileWinFXInternal" in file "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "Compile" depends on it):
1>Target "CodeContractReferenceAssembly" in file "C:\Program Files (x86)\Microsoft\Contracts\MsBuild\v12.0\Microsoft.CodeContracts.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "Compile" depends on it):
1>Target "Compile" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CoreBuild" depends on it):
1>Target "_GenerateSatelliteAssemblyInputs" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CreateSatelliteAssemblies" depends on it):
1>Target "CreateSatelliteAssemblies" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CoreBuild" depends on it):
1>Target "GetTargetPath" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CoreBuild" depends on it):
1>Target "_CopyFilesMarkedCopyLocal" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CopyFilesToOutputDirectory" depends on it):
1>Target "GetCopyToOutputDirectoryXamlAppDefs" in file "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Xaml.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "GetCopyToOutputDirectoryItems" depends on it):
1>Target "GetCopyToOutputDirectoryItems" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "_CopySourceItemsToOutputDirectory" depends on it):
1>Target "_CopySourceItemsToOutputDirectory" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CopyFilesToOutputDirectory" depends on it):
1>Target "_CheckForCompileOutputs" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CopyFilesToOutputDirectory" depends on it):
1>Target "CopyFilesToOutputDirectory" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "PrepareForRun" depends on it):
1> FSharpProject -> c:\Projects\TestFSharpBuild\FSharpProject\bin\Debug\FSharpProject.dll
1>Target "PrepareForRun" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CoreBuild" depends on it):
1>Target "_CleanGetCurrentAndPriorFileWrites" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "IncrementalClean" depends on it):
1>Target "IncrementalClean" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "CoreBuild" depends on it):
1>Target "CoreBuild" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "Build" depends on it):
1>Target "AfterBuild" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (target "Build" depends on it):
1>Target "Build" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "c:\Projects\TestFSharpBuild\FSharpProject\FSharpProject.fsproj" (entry point):
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
This is just a problem with how the overall build results are reported. That is, even though it says it builds (and F# projects never increase the count in the "up-to-date" category) it doesn't actually invoke the compiler, or you would see a line with fsc.exe in the log somewhere. It just invokes the build target which then detects the fact that the output is already up to date. It's still arguably a bug, but not a very significant one...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With