Bonjour,

Je voudrai lancer un fichier MSI à partir d'un fichier setup.exe. Le lancement du premier fichier se fait en utilisant des paramètres de commande. Mais le soucis c'est que ces variables ont des valeurs vides et pas ceux que j'ai déjà calculé.

Je lance le setup comme suit
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
setup.exe /l* log.txt EXEPATH="C:\Program Files (x86)\MySetup\MyApplication.exe"
Voici le fichier msbuild pour générer le setup.exe :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<Project ToolsVersion="4.0"
   xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <PropertyGroup>
      <exeD Condition="'$(EXEPATH)'!=''">$(EXEPATH.substring(0,$([MSBuild]::Add($(EXEPATH.lastIndexOf("\")),1))))</exeD>
      <exeFile Condition="'$(EXEPATH)'!=''">$(EXEPATH.substring($([MSBuild]::Add($(EXEPATH.lastIndexOf("\")),1))))</exeFile>
      
    </PropertyGroup>

    <ItemGroup>
        <BootstrapperFile Include="Microsoft.Windows.Installer.4.5" >
            <ProductName>Windows Installer 4.5</ProductName>
        </BootstrapperFile>
    </ItemGroup>

    <Target Name="Bootstrapper">
      <Message Text="exeD = $(exeD)"/>
      <Message Text="exeFile = $(exeFile)"/>
      <Message Text="EXEPATH = $(EXEPATH)"/>
      <Exec Command="msiexec /i MySetup.msi  /L log2.txt EXEDIR=&quot;$(exeD)&quot; EXEFILENAME=&quot;$(exeFile)&quot;" Condition="'$(EXEPATH)'!=''" />
      <!--<Exec Command="msiexec /i MySetup.msi  /L log2.txt EXEDIR=&quot;C:\Program Files (x86)\MySetup\&quot; EXEFILENAME=&quot;MyApplication.exe&quot;" />-->
    </Target>
</Project>
Comme vous voyez je calcule deux paramètres exeD et exeFile que je dois passer au fichier MSI dont le fichier WIX est :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="MySetup" Language="1033" Version="1.0.0.0" Manufacturer="Sofiane" UpgradeCode="c151e7ab-b83a-445f-93b2-2ab7122ea34b">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Property Id="EXEDIR" Secure="yes" Value="{}"/>
    <Property Id="EXEFILENAME" Secure="yes" Value="{}"/>


    <Feature Id="ProductFeature" Title="MySetup" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>
    <Binary Id="InstallTools" SourceFile="$(var.SolutionDir)InstallTools\bin\$(var.Configuration)\InstallTools.dll"/>
    <Binary Id="NotepadPlus" SourceFile="C:\Program Files (x86)\Notepad++\notepad++.exe"/>
    <CustomAction Id="OpenExe" Return="ignore" Directory="exeDirectory"  ExeCommand="&quot;[EXEDIR]\[EXEFILENAME]&quot;" Impersonate="yes" Execute="deferred"/>
    <InstallExecuteSequence>
      <Custom Action="OpenExe" Before='InstallFinalize'/>
    </InstallExecuteSequence>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="MySetup" />
      </Directory>
      <Directory Id="exeDirectory" FileSource="@(EXEDIR)" />
    </Directory>
  </Fragment>

  <Fragment>
    <DirectoryRef Id="INSTALLFOLDER">
      <Component Id="myAppFile">
        <File Source="$(var.MyApplication.TargetPath)" />
      </Component>
    </DirectoryRef>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
      <!-- <Component Id="ProductComponent"> -->
      <ComponentRef Id="myAppFile" />
      <!-- </Component> -->
    </ComponentGroup>
  </Fragment>

</Wix>
Dans le fichier log j'ai :
Info 1721.There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: OpenExe, location: D:\, command: "{}\{}"

Quelqu'un peut aider SVP ?