Comment générer un bootstrapper clickonce sans utiliser visual studio

 

Dans le cadre d'une software factory , j'avais besoin de pouvoir generer à la volée des bootstrappers clickonce personnalisés par client, et bien entendu visual studio 2005 ne s'y prete pas dans ce cas, mais Microsoft a tout prevu, il suffit d'utiliser MSBuild, une tache est dediée a ce sujet, on peut trouver le documentation sur le site msdn a l'adresse suivante :

http://msdn2.microsoft.com/en-us/library/ms164294(VS.80).aspx

dans un premier temps il faut produire un ficher (bootstrapper.xml) contenant les informations pour produire le bootstrap, de la forme suivante par exemple :

 

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup>
    <BootstrapperPackage Include="Microsoft.Data.Access.Components.2.8">
      <Visible>False</Visible>
      <ProductName>Microsoft Data Access Components 2.8</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
      <Visible>False</Visible>
      <ProductName>.NET Framework 2.0</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.ReportViewer.8.0">
      <Visible>False</Visible>
      <ProductName>Microsoft Visual Studio 2005 Report Viewer</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="{511DAC48-6CBB-43a3-A64D-0182F2A9EBC2}">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.0</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
   </ItemGroup>

   <Target Name="Bootstrapper">
      <GenerateBootstrapper
         ApplicationName="Mon application"
         ApplicationUrl=http://deploy.mondomaine.com"
     ApplicationFile="monapp.application"
         BootstrapperItems="@(BootstrapperFile)"
         Culture="fr"
         CopyComponents="True"
         OutputPath="c:\temp" />
   </Target>
</Project>

En l'occurence j'ai volontairement indiqué que je voulais que soient installés MDac 2.8 le framework 2.0 et 3.0 et report viewer

mon url de deployement est http://deploy.mondomaine.com/monapp.application

Pour produire le fichier setup.exe il faut lancer la commande suivante :

C:\Windows\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe "bootstrapper.xml"

il ne reste plus qu'a recuperer le fichier dans le repertoire c:\temp (parametre outputpath du fichier xml)

Aucun commentaire: