In my experience, using the BeforeBuild/AfterBuild targets explicitly is always 
a better choice than PreBuild or PostBuild.  The only advantage of 
PreBuild/PostBuild is you don't need to know any MSBuild syntax.  That's also 
the main disadvantage.

--
John Merryweather Cooper
Build & Install Engineer - ESA
Jack Henry & Associates, Inc.®
Shawnee Mission, KS  66227
Office:  913-341-3434 x791011
jocoo...@jackhenry.com
www.jackhenry.com



-----Original Message-----
From: Tony [mailto:yellowjacketl...@gmail.com] 
Sent: Thursday, June 26, 2014 9:32 AM
To: General discussion about the WiX toolset.
Subject: Re: [WiX-users] Build order problems Votive vs MSBuild

I know this conversation is a bit old, but I figured out the real issue.
And it is worth sharing in case others run into a similar problem.

It appeared as though we had a build order issue with our wix projects as 
described elsewhere in this thread (works in VS, but fails with MSBuild).
I "fixed" the issue as described below.  However, this proved to just be a 
Band-Aid and/or we just "got lucky".

Recently I made changes to another wixlib project to reference two new C# 
projects and the mysterious "build order" (fails with MSBuild, not in VS) 
manifested itself again.  WTF?

After carefully combing through the build output, I _think_ I know what is 
causing this issue.  It is the "Pre-Build Events".  When MSBuild "builds" a 
project it executes the Pre-Build Events _before_ it evaluates the project's 
dependencies (which, if not built already, will trigger dependent projects to 
get built).  In our case, our pre-build events on our wix projects were used to 
run Paraffin to auto-generate wxs files for our websites and sign the website's 
binaries.  This would fail because the website itself had not been built yet 
because MSBuild had not reach the point in which it would trigger the build of 
dependent projects.

This issue does not happen with VS builds as VS doesn't use MSBuild to evaluate 
project dependencies as described in the link elsewhere in this thread.  So, in 
our case VS builds the website prior to building the wixlib that executes the 
Pre-Build Paraffin and the wixlib project builds without issue.

I'm not sure how I'll fix this issue long-term.  But it goes without saying 
that I look forward to WiX 4.0's ability to leverage the now defunct "Harvest" 
option on project references.<g>



On Wed, Jun 4, 2014 at 2:00 PM, Tony <yellowjacketl...@gmail.com> wrote:

> Follow-up....
>
> Our old VS2012 solution was organized like this...
>
> A.vsxproj (C++)
> B.csproj (C#)
> C.csproj (C#)
> W.wixproj (WiX)
>
> Where project-B had a SOLUTION dependency on the C++ project-A.  And 
> the WiX project has project dependencies on both project-B and 
> project-C.  When built via VS2012, the solution build order would be A, B, C, 
> W.
> However, when MSBuild built this solution, the build order A, C, W, B.  
> As expected, building project-W would fail because project-B's output 
> was nowhere to be found.
>
> I followed the instructions in the link Rob provided and removed the 
> SOLUTION dependency between project-B and project-A.  Instead, I 
> manually edited project-B's csproj file to add a PROJECT dependency to 
> project-A
> (VS2012 won't let you add a C++ as a project reference to a C# project).
> After reloading project-B, I now see project-A in project-B's 
> References list.  Though, depending on VS2012 mood at the time, it may 
> or may not have a little yellow triangle next to project-A's entry.
>
> Now via both VS2012 and MSBuild, the build order is A, B, C, W.
>
> I still don't quite understand why the changes make it work, but I'm 
> glad it does.<g>
>
>
>
> On Wed, May 28, 2014 at 6:19 PM, Rob Mensching <r...@firegiant.com> wrote:
>
>> Sounds a lot like:
>> http://blogs.msdn.com/b/msbuild/archive/2010/12/21/incorrect-solution
>> -build-ordering-when-using-msbuild-exe.aspx
>>
>> _______________________________________________________________
>>  FireGiant  |  Dedicated support for the WiX toolset  | 
>> http://www.firegiant.com/
>>
>> -----Original Message-----
>> From: Tony [mailto:yellowjacketl...@gmail.com]
>> Sent: Wednesday, May 28, 2014 1:56 PM
>> To: WiX Users
>> Subject: [WiX-users] Build order problems Votive vs MSBuild
>>
>> We've run into this issue in which it appears as though our .sln 
>> builds correctly when built through VS (Votive installed), but when 
>> built using MSBuild, the WiX project dependencies appear to be 
>> ignored.  This results in a build order problem (csproj is built 
>> _after_ wixproj that needs its output).  If the build order is forced 
>> (manually add a dependency in the sln file), the MSBuild build works 
>> fine.  As such, it appears as if MSBuild is used on the .sln, the 
>> auto generated project dependency list (and thus build order) is not correct.
>>
>> NOTE:  We do NOT have WiX installed on our build server.  I have 
>> modified our wixproj files per 
>> http://wixtoolset.org/documentation/manual/v3/msbuild/daily_builds.html.
>>
>> I found an old thread titled "Problem with build order under MSBuild 4.0"
>> (4/14/10) that describes an identical issue.  And another thread 
>> titled
>> "Wix3.6.1518.0 to 3.6.1915.0 issue" (7/20/11) in which this bug 
>> http://sourceforge.net/p/wix/bugs/2588/ is linked.  But I can't tell 
>> if the bug was fixed or just closed.
>>
>> Any ideas?
>>
>> VS/TFS2012, Wix 3.8
>> --
>> Tony
>>
>> ---------------------------------------------------------------------
>> --------- Time is money. Stop wasting it! Get your web API in 5 
>> minutes.
>> www.restlet.com/download
>> http://p.sf.net/sfu/restlet
>> _______________________________________________
>> WiX-users mailing list
>> WiX-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>
>>
>> ---------------------------------------------------------------------
>> --------- Time is money. Stop wasting it! Get your web API in 5 
>> minutes.
>> www.restlet.com/download
>> http://p.sf.net/sfu/restlet
>> _______________________________________________
>> WiX-users mailing list
>> WiX-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>
>
>
>
> --
> Tony
>



--
Tony
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse Turn 
processes into business applications with Bonita BPM Community Edition Quickly 
connect people, data, and systems into organized workflows Winner of BOSSIE, 
CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft 
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
NOTICE: This electronic mail message and any files transmitted with it are 
intended
exclusively for the individual or entity to which it is addressed. The message, 
together with any attachment, may contain confidential and/or privileged 
information.
Any unauthorized review, use, printing, saving, copying, disclosure or 
distribution 
is strictly prohibited. If you have received this message in error, please 
immediately advise the sender by reply email and delete all copies.


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to