[wix-users] Incremental builds

Edwin Castro egcastr at gmail.com
Fri Nov 4 13:44:17 PDT 2016


To do something like this, you'll need to update the Target/@Inputs
attribute for the corresponding target. In this case modifying the
Compile target might work. As an example, looking at wix2010.targets
from WiX 3.9 I see the Compile target defined as

  <PropertyGroup>
    <CompileDependsOn>
      PrepareForBuild;
      ResolveWixExtensionReferences;
      GenerateCompileWithObjectPath
    </CompileDependsOn>
  </PropertyGroup>
  <Target
    Name="Compile"
    Inputs="@(Compile);
            @(Content);
            @(_ResolvedWixExtensionPaths);
            @(_ResolvedProjectReferencePaths);
            $(MSBuildAllProjects)"
    Outputs="@(_CompileWithObjectPath ->
'%(ObjectPath)%(Filename)$(IntermediateExt)')"
    DependsOnTargets="$(CompileDependsOn)"
    Condition=" '@(Compile)' != '' ">

...

  </Target>

Note that Target/@Inputs specifies a number of ItemGroups including
@(Content). You'd have to ensure that adding this metadata file to
@(Content) won't cause other issues, but if it doesn't, then you can
generate your metadata file as @(Content) and MSBuild should consider
the metadata file when determining if it needs to perform an
incremental build. You would add something like the following to your
.wixproj:

  <ItemGroup>
    <Content Include="DefineConstants.meta" />
  </ItemGroup>

Of course, you'd want your code for generating DefineConstants to run
before Compile runs. Perhaps you could override the CompileDependsOn
property to run your custom target. For example,

  <PropertyGroup>
    <CompileDependsOn>
      $(CompileDependsOn);
      GenerateDefineConstantsMeta
    </CompileDependsOn>
  </PropertyGroup>

--
Edwin G. Castro


On Fri, Nov 4, 2016 at 12:45 PM, Hoover, Jacob
<Jacob.Hoover at greenheck.com> wrote:
> Yeah, that's where I was thinking of an optional property to define. It could integrate into the existing targets, which would take the DefineConstants and add it to an intermediate file.  On second build, before writing to the file it could read from it and compare the property to the file to determine if it needs to write to the file.
>
>
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Rob Mensching
> Sent: Friday, November 04, 2016 12:17 PM
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> Subject: Re: [wix-users] Incremental builds
>
> Overriding a Property from the command-line will not cause a project to be considered dirty. You need that Property to "physically" change something (part of path to select a file with newer timestamp, cause a task to run to modify a file, etc).
>
> _____________________________________________________________
>  Short replies here. Complete answers over there: http://www.firegiant.com/
>
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Hoover, Jacob
> Sent: Friday, November 4, 2016 7:58 AM
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> Subject: [wix-users] Incremental builds
>
> I'm trying to get incremental builds working, and I am fairly certain this is a MSBuild problem not a wix problem.  I have a Wix project which is built using a CI server where a build number is passed to the project as a property.  I then use a DefineConstants element in the wixproj to pass my custom property to wix via a variable.
>
> SomeApplication.wixproj /p: BuildNumber={CI variable syntax for the build}
>
> And in the wixproj:
> <VersionMajorMinor>1.0</VersionMajorMinor>
> <BuildNumber Condition=" '$(BuildNumber)' == '' ">2</BuildNumber> <ProductVersion>$(VersionMajorMinor).$(BuildNumber).0</ProductVersion>
>     <DefineConstants>
>       $(DefineConstants);
>       ProductVersion=$(ProductVersion);
>       BuildNumber=$(CIBuildNumber);
>     </DefineConstants>
>
> And finally in my Product.wxs, I consume the ProductVersion via:
> <Product Id="*" Version="$(var.ProductVersion)" Name="..."
>
> Is there some standard functionality in MSBuild I am missing to be able to say the build is dirty if a property changes? I know MSBuild looks at file timestamps to determin if a target is needed via the inputs and outputs, so what I am tinking I'd need to do is add a file for the DefineConstants, inject them into the compile DependsOnTargets, and then only write the file after reading the values and comparing them to the current DefineConstants if they are different. Shouldn't a DefineConstants change triggering a build be an intergral part of the wix targets?
>
> Thanks,
> Jacob
>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/


More information about the wix-users mailing list