Scenario:
I have a TFS Build (TFS2008) that has several targets override: BuildNumberOverrideTarget, AfterGet, BeforeCompileConfiguration, AfterCompileConfiguration, AfterCompile, AfterDropBuild and AfterEndToEndIteration. Everything works fine.
But now I am porting all CI to Jenkins server. I use MSBuild plugin to invoke TFSBuild.proj using these parameters:
/fileLogger /fileLoggerParameters:LogFile=TFSBuild_DesktopBuild.log;Create;Encoding=UTF-8;verbosity=normal /verbosity:normal
Problem Description:
My problem is that only some of the custom tasks are being executed: BeforeCompileConfiguration, AfterCompileConfiguration, AfterCompile.
As you can see I need BuildNumberOverrideTarget, AfterGet, AfterDropBuild and AfterEndToEndIteration to be executed.
It seems like only compile task and custom tasks about it are being executed. The build being triggered from TFS is treated as Non Desktop Build while the build being triggered from Jenkins is treated as Desktop Build.
What I have tried until now.
If I run the build from a local .cmd file, same behaviour happens. So I think is a problem with IsDesktopBuild property. Further reading of this msdn link gave me the clue to when read
"Only the compilation and testing (if they are enabled) are performed"
. So I have tried to add property myself to force a DesktopBuild:
/fileLogger /fileLoggerParameters:LogFile=TFSBuild_DesktopBuild.log;Create;Encoding=UTF-8;verbosity=normal /verbosity:normal /property:IsDesktopBuild=true
But behavior is the same, only executed tasks: BeforeCompileConfiguration, AfterCompileConfiguration, AfterCompile
So my question is double:
You shouldn't be trying to force a desktop build. In fact, you should be heading the opposite direction - forcing a non-desktop build.
Desktop builds are the default. That means, by default IsDesktopBuild=true. So there's no need to set it explicitly.
When TFS Build does a build, it passes false to IsDesktopBuild.
To get Jenkins to run the same tasks as TFS Build, you should have it pass false to IsDesktopBuild. Instead of:
/fileLogger /fileLoggerParameters:LogFile=TFSBuild_DesktopBuild.log;Create;Encoding=UTF-8;verbosity=normal /verbosity:normal /property:IsDesktopBuild=true
you should set IsDesktopBuild to false:
/fileLogger /fileLoggerParameters:LogFile=TFSBuild_DesktopBuild.log;Create;Encoding=UTF-8;verbosity=normal /verbosity:normal /property:IsDesktopBuild=false