Domanda

Ho una build in esecuzione in TFS TeamBuild. Voglio passare una proprietà da quella a MSBuild che viene eseguita per ciascun progetto creato da TFSBuild.proj.

Esempio:

TFSBuild.proj

<PropertyGroup>
   <Version>0.0.0.0</Version>
</PropertyGroup>

<Target Name="BuildNumberOverrideTarget" 
        DependsOnTargets="AfterInitializeWorkspace">

  <!--Code that loads the version from a file (removed).-->

  <PropertyGroup>
    <!--Save off the version.-->
    <Version>$(TxCompleteVersion)</Version>
</PropertyGroup>

MyWIXProjectFile.wixproj

<Target Name="BeforeBuild">
<PropertyGroup>
  <!--If Version is defined then use that.  
   Else just use all zeros to show that this is a developer built version-->
  <CurrentVersion Condition="'$(Version)' == ''" >0.0.0.0</CurrentVersion>
  <CurrentVersion Condition="'$(Version)' != ''" >$(Version)</CurrentVersion>
</PropertyGroup>
<Message Condition="'$(Version)' == ''" 
         Text="Version info is empty (i.e. a developer build).  Version set to $(CurrentVersion)"/>

</Target>

Quando MyWixProjectFile.wixproj viene creato, il messaggio che mostra che $ (Versione) è vuoto viene stampato ogni volta.

Esiste un modo per ottenere il file di progetto per vedere le proprietà TFSBuild.proj?

Vaccano

È stato utile?

Soluzione 2

Questo viene fatto tramite i metadati delle proprietà nel tag SolutionToBuild. Ad esempio:

  <ItemGroup>
    <SolutionToBuild Include="$(BuildProjectFolderPath)\ChangeThisOne.sln">
      <Targets></Targets>
      <Properties>Change=True</Properties>
    </SolutionToBuild>
    <SolutionToBuild Include="$(BuildProjectFolderPath)\ChangeThisToo.sln">
      <Targets></Targets>
      <Properties>Change=True</Properties>
    </SolutionToBuild>
    <SolutionToBuild Include="$(BuildProjectFolderPath)\DontChangeThis.sln">
      <Targets></Targets>
      <Properties>Don'tChange=False</Properties>
    </SolutionToBuild>
  </ItemGroup>

Altri suggerimenti

Non sono un esperto di Wix ma l'ho trovato e ho pensato che potresti provarlo.

Impostazione delle proprietà per WiX in MSBuild

Opzione 1

Usa MSBuild per chiamare direttamente MyWIXProjectFile.wixproj e passare la versione come proprietà

Opzione 2

Estrarre la build di wix con il proprio script contenuto automaticamente e quindi utilizzare MSBuild per chiamare direttamente e passare tutte le proprietà necessarie. Ho un blog con la piena implementazione facendo questo a http://blog.newagesolution.net/2008/06/how-to-use-msbuild-and-wix-to-msi.html che potrebbero interessarti.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top