77855

Why does Tfs2010 build my Wix project before anything else?

Question:

A similar question was asked and answered about a year ago, but was either a different issue (everything was in beta) or misdiagnosed. It's located here: <a href="https://stackoverflow.com/questions/688162/msbuild-task-fails-because-any-cpu-solution-is-built-out-of-order" rel="nofollow">MSbuild task fails because "Any CPU" solution is built out of order</a>.

My issue is that I have a wix installer project, and after upgrading to Tfs2010 on monday, the build fails on linking because it can't find the build product of the Wpf application in the project. After some digging, it's because it hasn't been built yet. Building in Vs2010 works as normal. The wix project is set to depend on the Wpf project, and when viewing Project Build Order in the IDE, everything looks as normal.

The problem was originally encountered with only two platform definitions in the solution; x86 and x64. There are also two flavors, Debug and Release, and TFSBuild.proj is set to build all four combinations. There was no occurence of AnyCPU anywhere. Per the referenced question above, I tried changing the Wpf project to use AnyCPU so that it would be built first. At this point, the wix project used the exact configuration and the Wpf project used the flavor with AnyCPU. However, doing so didn't seem to change anything.

I'm using the Tfs2010 RTM, Vs2010 RTM, and the most recent version of Wix, which at the time of this writing is 3.5.1602.0, from 2010-04-02. Anyone else running into this?

<strong>2010-04-27</strong>: After a fair amount of digging, and reproducing on a cloned VM build machine, I believe I know what's going on and also what's failing, but I don't quite know how to fix it.

The situation is that this bug seems to exhibit symptoms based on pure luck-of-the-draw project ordering in the solution file. It appears as if the solution file will just blindly build the projects in the order they appear, relying on its ability to detect unbuilt references and build them on demand when needed.

In my particular solution file, my Wix project was ordered before my Wpf application project. This resulted in the Wix project being built first, and while the dependency on the Wpf project was detected correctly, the actual MSBuild task was skipped because of the undefined $(BuildProjectReferences) variable I mention a couple of comments down from the main post in this thread. With MSBuild verbosity still on diagnostic, BuildProjectReferences can be seen as undefined building the Wix project, and it can be seen defined as true upon building the Wpf project within the task to build the Wix project. Yet, when tested, it evaluates undefined again, the task is skipped, and the Wix build fails because it can't find the build output of the unbuilt Wpf project.

So bottom line: project dependency is skipped because of bad $(BuildProjectReferences) variable. Interestingly, this variable is present only in the Wix2010.targets file, and not in wix.targets; I guess that's why this is just showing up after I installed Tfs2010 and Vs2010.

The solution: How do I make sure that BuildProjectReferences is passed along correctly to the subsequent MSBuild tasks? Is there something special with variable scoping going on?

<strong>2010-09-14</strong>: A bug was opened for this issue in the WiX toolset: <a href="http://sourceforge.net/tracker/?func=detail&atid=642714&aid=2990231&group_id=105970" rel="nofollow">http://sourceforge.net/tracker/?func=detail&atid=642714&aid=2990231&group_id=105970</a> and fixed a while ago. Hopefully, this is no longer an issue. If so, please do open a new bug.

<hr />

To address your comment directly, nothing in my solution has an AnyCPU configuration in their build files. I created the AnyCPU configurations only to test the solution suggested by the thread I linked to in my original post. After it didn't work, I removed the AnyCPU configurations again.

Furthermore, the projects are in the same solution file, however in separate solution folders (interface folder, installer folder) if that matters.

Interestingly enough, I was going to make a small sandbox example so that I could illustrate the problem I was having, however after creating my tiny sample solution, I couldn't get the error to reproduce. This makes me think that perhaps this is a result of using a team project that was upgraded from a Tfs2008 team project rather than one that was created fresh in Tfs2010. I may try branching my project into a new one to test this theory if I can't figure out why the test solution works.

p.s. also, I'm new to stackoverflow--why on earth are comments limited in length if the "answer your own question" workflow is intended only to provide concrete answers?

<hr />

So I threw the build verbosity up to diagnostic and read through it today, and one line in particular stood out to me:

Task "MSBuild" skipped, due to false condition; ('@(_ProjectReferenceWithConfiguration)'!='' and '$(BuildingInsideVisualStudio)' != 'true' and '$(BuildProjectReferences)' == 'true' and '@(_MSBuildProjectReferenceExistent)' != '') was evaluated as ('..\WpfApp\WpfApp.csproj'!='' and '' != 'true' and '' == 'true' and '..\WpfApp\WpfApp.csproj' != '').

This was seen as my installer project was attempting to build my wpf project since the wpf project is referenced. In particular, for some reason $(BuildProjectReferences) is evaluating to '' when I'm fairly sure it should be 'true'.

However earlier in the log, at the beginning of the MSBuild task for the WpfApp project, I saw this:

Task "MSBuild" (TaskId:15) ... Initial Properties: ... BuildProjectReferences = true

So the property was indeed correct up until the beginning of the task, but then was apparently overwritten? I'm sort of unclear as to how these properties get set.

Answer1:

Its a bug, a bug, a bug. Dunno who is responsible, but here's a working dirty filthy hack:

<ol><li>Open your .sln file in notepad. </li> <li>Find your wix projects in the list of projects. </li> <li>Cut them out, and paste them back after all other projects are listed. </li> <li>Cry in the shower as you try to scrub the dirty off, only to emerge hours later, rubbed raw and still with the stench of filth clinging to you like corpse's skin.</li> </ol>

Answer2:

Following Rob Mensching's edit of my original post, it seems that this has indeed been fixed in WiX 3.6.0917.0 at the latest.

Answer3:

I was seeing this problem (wix 3.7 not finding the dependent project output) in my local and TFS builds (for both VS2010 and VS2012).

I finally got around it by setting the msbuild property /m:1 to only use a single build process. I set /m to allow msbuild to figure out how many processes it could use to simultaneously build with.

Answer4:

TFS uses a set of properties to control the names of the solutions and configurations to build ( iterate through ). For each combination of solution and configuration it then uses the project dependencies / build order to control the order of the projects getting built. It's possible that your EXE/DLL's are AnyCPU and that your WiX is x86 and that although the WiX has a dependency on the EXE/DLL the x86 is built before your AnyCPU. Or maybe they are even in different solutions so it's kind of hard to tell without looking at your source but that's basically how it works.

Answer5:

What we did is to first <a href="http://sourceforge.net/tracker/?func=detail&atid=642714&aid=2990231&group_id=105970" rel="nofollow">report the bug to wix</a> and then we found your question.

We solved the problem on our side by saying that, by default, the wix project will build the references. We updated the file C:\Program Files\MSBuild\Microsoft\WiX\v3.5\wix2010.targets by setting <BuildProjectReferences>True</BuildProjectReferences> in the project which set the path. So, yes, we have done this manually ; we have reported the bug as well as our fix.

Answer6:

I faced with a same problem today and find a solution like this:

Open your solution file on notepad the find your setup project and change postProject setting. This will tell msbuild this project should wait another project to build. I don't know why but it is not added by default.

Project("{GUID}") = "MyInstaller", "MyInstallerPath", "{Installer Project GUID}" ProjectSection(ProjectDependencies) = postProject {Prebuild Project GUID} = {Prebuild Project GUID} EndProjectSection EndProject

'Prebuild Project GUID' is the number on the right of the project that you want to install.

Recommend

  • Getting ticks in figure with subplots
  • Fast rolling correlation in Matlab
  • Correlation matrix heatmap with multiple datasets that have matching columns
  • How to calculate correlation between all columns and remove highly correlated ones using python or p
  • Windows Theano Keras - lazylinker_ext\\mod.cpp: No such file or directory
  • MySQL - selecting from multiple tables, possibly without joins?
  • how to change “eheap_alloc” size on windows system to run erlang server?
  • jQuery colorbox loading 2 iframes
  • How to pass all columns except one as argument to setkey()?
  • TeamCity NuGet package build for different .NET Frameworks
  • Making Toplevel resize itself to fit the title
  • Perl Moose accessors generated on the fly
  • Sort python list of dictionaries by key if key exists
  • How to set UIImageView in the center of screen horizontally or vertically with Swift, but no more St
  • What types of languages allow programmatic creation of variable names?
  • How does `super` interacts with a class's `__mro__` attribute in multiple inheritance?
  • Building SSIS solution using visual studio online build definition… .dtproj is not supported by MSBu
  • AngularFire httpsCallable Object(…) is not a function
  • Build a string in MSBuild as a concatenation of a base string n-times
  • MSBuild: OutputPath directory is empty
  • Skip a project while building a solution using msbuild 3.5
  • How to convert NAnt function “path::combine(path1, path2)” to MSBuild?
  • SSIS package hangs while running
  • How can I include the Ivy dependency and none of its dependencies?
  • How to force Composer to download a local package?
  • How do you create a Fuseki SPARQL server using the Apache Jena Java API?
  • Angular2 - Template reference inside NgSwitch
  • How do I get the list of bad records that didn't load in Bigquery?
  • Getting error 'Cannot read property 'document' of undefined' while importing exp
  • SyntaxError: (irb):26: both block arg and actual block given
  • Salesforce Different WSDL files and when to use
  • Silverlight DependencyProperty.SetCurrentValue Equivalent
  • presentShareDialogWithParams posts to FB wall, but callback handler results say error
  • java inputstream
  • Time complexity of a program which involves multiple variables
  • Checking free space on FTP server
  • Control modification in presentation layer
  • Accessing IRQ description array within a module and displaying action names
  • Javascript Callbacks with Object constructor
  • Where to put my custom functions in Wordpress?