Question

I am trying to do continuous integration with Team city and trying to update my build.

What should do?

In this order build is suppose to create 4 folders and msi builds with in the folders(VWriter_1.9.1.46903_Live.msi),Local(VWriter_Local.msi),Test(VWriter_Test.msi) and UAT(VWriter_UAT.msi), which is doing fine in my local and I am expecting same in live.

What it is doing.

It is acting weird when build is checked in live in team city it is creating only VWriter_UAT.msi 4 times.

My build.xml code:

<CallTarget Targets="PreBuildDeploymentEvent" />

<CallTarget Targets="BuildUATVoteWriterDeploymentProject" />

<CallTarget Targets="BuildVoteWriterDeploymentProject" />

<CallTarget Targets="BuildLocalDevelopmentVoteWriterDeploymentProject" />

<CallTarget Targets="BuildTestVoteWriterDeploymentProject" />

Target:

<CallTarget Targets="FixFilePathsForLiveDeployment" />

<MSBuild Projects="..\src\Deployment\VoteWriterInstaller.wixproj" Properties="Configuration=Release;OutDir=$(MSBuildProjectDirectory)\Live Release\;" Targets="Clean;Build;"/>

<ItemGroup>
  <DeleteAfterBuild Include="$(MSBuildProjectDirectory)\Live Release\*.*" Exclude="$(MSBuildProjectDirectory)\Live Release\*.msi"  />
</ItemGroup>
<Delete Files="@(DeleteAfterBuild)" />

FixFilePathsForLiveDeployment:

  <!-- Fix Web Service For Live -->

 <Target Name="FixFilePathsForLiveDeployment">

 <CallTarget Targets="AlterMsiFileNamesLive" />

  </Target>

AlterMsiFileNamesLive:

  <Target Name="AlterMsiFileNamesLive">

<ItemGroup>
  <WixProject Include="Item">
    <Path>..\src\Deployment\VoteWriterInstaller.wixproj</Path>
  </WixProject>
</ItemGroup>

 <FileUpdate Files="%(WixProject.Path)" 
      Regex="(\x3COutputName>.+?)(?:_.+?)??(\x3C/OutputName>)"

      **ReplacementText="${1}_$(Version)_Live${2}" />**
      // This is not creating as Live this is picking UAT file extension name. 

I am not getting where it is going wrong.

Any help is much appreciated also please let me know if it is not clear I will try to put more notes.

Était-ce utile?

La solution

I'm no expert in MSbuild and thus i'm finding your details very confusing. However, i have couple of Wix projects myself which build in a custom folder when MSbuild is used.

I believe your problem lies somewhere in paths, they are not resolving correctly.

My solution was to create some general path properties so that the folder structure is the same wherever i build. I don't know your source folder structure but i guess if you want to go this way you can adjust them by yourself. For example:

  <PropertyGroup>
      <RootDir>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..'))\</RootDir>
      <WorkingFolder>$(RootDir)src\</WorkingFolder>
      <OutDir>$(RootDir)MSI\</OutDir>
      <OutputPath>$(OutDir)</OutputPath>
  </PropertyGroup>

So the RootDir property will sets the path to the root of the branch (src) then every other path is created from that RootDir so that they are consistent on any machine that is building.

Then i put all Wix properties that i want to pass to wixproj in one msbuild property:

  <PropertyGroup>
    <WixProperties>
      WixToolPath=$(WixToolPath);
      WixTargetsPath=$(WixTargetsPath);
      WixTasksPath=$(WixTasksPath);
      DefineSolutionProperties=false;
      OutputPath=$(OutputPath);
      WorkingFolder=$(WorkingFolder);
      SuppressBuildInfo=true;
    </WixProperties>
  </PropertyGroup>

Then finally the Build target:

  <Target Name="BuildMSI">
    <MSBuild Projects="$(WorkingFolder)WixMsi\$(MSIPackageName).wixproj"
             Properties="$(WixProperties)"
             Targets="Rebuild" />
  </Target>

My solution is much bigger than the example here which involves one common Msbuild Installation.proj which has all these properties and targets, then for each Wix project another projectX.proj which have an <Import Project="Installation.proj"/>

Notice the property MSIPackageName in BuildMSI target, since i have proj files for each of my Wix projects i define that property in those proj files which in turn are passed to the main installation.proj.

This way you can have different output folder for each wix. You just adjust OutDir property in the first property group to something like this <OutDir>$(RootDir)MSI\$(MSIPackageName)</OutDir> or develope it even further and define those in each projectx.proj

Finally if you want only one .proj to run create a master proj file which will call each project.

  <Target Name="BuildMSIProjects">
    <ItemGroup>
      <WixProjectFiles Include="WixMsi\projectX.proj" />
      <WixProjectFiles Include="WixMsi\projectY.proj" />
      <WixProjectFiles Include="WixMsi\projectZ.proj" />
    </ItemGroup>
    <MSBuild Projects="@(WixProjectFiles)"/>
  </Target>

I know i made a mess but it's not so easy to explain the whole project in few words.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top