Wednesday, October 15, 2014

WIX failed to see source files when building using TfvcTemplate.12.xaml

Recently, I started using TfvcTemplate.12.xaml, after reading this msdn article: i.e. executing PowerShell script as Pre-Build event while implementing versioning.

Initially, without using any script, when I simply tried to build my solution, Wix was unable to see its sources files. I verified multiple times that files were there and it builds without any problem at command line using MsBuild and Wix Toolset commands. In addition, I changed the build definition to older DefaultTemplate.11.xaml and it worked fine.

After some experiments, I doubted about MsBuild’s parallel processing ability i.e. it might be building installer project (*.wixproj) before building my other projects. So, again I used TfvcTemplate.12.xaml and passed “/m:1” and here it is: The liner processing solved the problem and I got to know what was going wrong:

TfvcTemplate.12.xaml seems to be executing MsBuild with parallel processing enabled (/m), while in my VS Solution, Wix project was added independently i.e. in Build Order it was the last project to build, but I never set other projects as its dependency. So MSBuild found that it has no dependency and ignored its Build Order and simply building it either on random order or as first project.

I verified this phenomena by removing /m:1 argument to MSBuild and declaring all other projects as Dependencies of Wix Project: i.e. in VS, PROJECT –> Project Dependencies. This caused MsBuild to build all other projects before Wix Project and now Wix is able to find its Source files properly…

Here is the screen shot for illustration:

TfvcTemplate_MSBuildConfig

No comments: