Question

Hi I have a solution which is compiled with a custom msbuild file.

Recently I have changed my machine from a Windows 7 machine to a new Windows 8.1 machine.

when running msbuild on the new machine it fails to build the solution, apparently because it is ignoring dependent projects that should be built ahead of other projects. This does not happen with the same set of files on my old machine.

  • Both are running MSBuild 12.0.21005.1
  • Both have VS 2012 and 2013 installed
  • The patch numbers of .NET Framwork v4 are within a few build numbers of each other, with both on 4.0.30319.xxxx

It's driving me mad - the whole point of the new machine was to build this solution faster :)

Could anyone suggest sensible steps to resolve or at least diagnose this issue?

UPDATE: It appears to that msbuild thinks that there are no changes. I'm getting messages such as Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files. I can't seem to convince it otherwise. The process runs Clean, then Build, so how could it not build the project?

Was it helpful?

Solution 2

After much hunting I have the answer.

Firstly - it does not appear to have anything to do with skipping due to files being up-to-date.

by outputting the results of the build to text file I was able to hunt down a couple of lines that did not exist when building on my old machine including this warning:

(ResolveAssemblyReferences target) -> 
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3274: The primary reference "Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0". [C:\workspaces\git\soln\src\Orchard.Web\Modules\Orchard.Workflows\Orchard.Workflows.csproj]

We had previously updated our main web project to target .NET Framework 4.5, but some of the projects within the solution had been left on version 4.0. This worked fine on my old machine (the ones left on 4.0 should not have had references to anything built against 4.5), but clearly had problems on the new one.

On a hunch I upgraded all my projects within the solution (all 119) using this awesome tool http://visualstudiogallery.msdn.microsoft.com/47bded90-80d8-42af-bc35-4736fdd8cd13 , after which build succeeds.

I should be clear in pointing out

  1. The codebase was exactly the same on both machines
  2. We never had a problem that required upgrading the target versions of the additional projects before, just on this single machine
  3. The versions of msbuild and .NET frameworks are to all inspection, identical

Anyway - I hope someone reads this and gets to the root of their problem faster than I did!

OTHER TIPS

  • Command prompt is your best friend for debugging MSBuild. More specifically, the Developer Command Prompt for VS2012\2013.

  • Verify the build machine is clean from any previous builds binaries. Your build script should clean its workspace before compilation (unless its being handled by a build server). If using TFS, run tfpt treeclean.

  • Run the build with diagnostic log - msbuild build.proj /flp:Verbosity=diagnostic;LogFile=build.log

  • Run the build without concurrency - /m:1. With multiple processors, concurrent processes might fail complex builds when the /m switch is active.

  • Verify the correct MSBuild image is executed. Force full path (C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top