Here are my results.

WiX Code:

      <?ifndef env.Install_Environment ?>
        <?error env.Install_Environment variable must be defined per ifndef
?>
      <?endif ?>

      <?ifdef env.Install_Environment ?>
        <?if $(env.Install_Environment) = local ?>
        <ComponentRef Id="C__SPDeploy.kctools.local.config"/>
        <?endif ?>

        <?if $(env.Install_Environment) = dev ?>
        <ComponentRef Id="C__SPDeploy.kctools.dev.config"/>
        <?endif ?>

        <?if $(env.Install_Environment) = mo ?>
        <ComponentRef Id="C__SPDeploy.kctools.itg.config"/>
        <?endif ?>

        <?if $(env.Install_Environment) = prod ?>
        <ComponentRef Id="C__SPDeploy.kctools.prod.config"/>
        <?endif ?>
      <?else?>
        <?error env.Install_Environment is not defined per ifdef ?>
      <?endif?>

Batch file output:


C:\StarTeam
Projects\n-knowledgecentre-kc-tools\Deployment\BuildandPackage>SET
Install_Environment=mo

SUCCESS: Specified value was saved.

...

Done building project "kCTools.Deploy.wixproj".

Build succeeded.
C:\Program Files\MSBuild\Microsoft\WiX\v3.0\Wix.targets : warning : Solution
properties are only available during IDE builds or when building the
solution file from the command line. To turn off this warning set
<DefineSolutionProperties>false</DefineSolutionProperties> in your .wixproj
file.
    1 Warning(s)
    0 Error(s)

Ok .. it is finding the environment variable and I believe I solved the
problem.  It appears I need to do two things:

1.  After running MSBuild against my WiX project, I reset my
Install_Environment variable:  set Install_Environment=
2.  We use Borland's StarTeam for source control, and I include the WiX
project in the get latest call.  Normally there is no change to the wxs
files, unless of course we have some new components.  If the WiX project
does not exist locally, and I do a get latest, the output of the WiX compile
looks like:

Target Compile:
    C:\Program Files\Windows Installer XML v3\bin\candle.exe
-d"DevEnvDir=*Undefined if not building from within Visual Studio*"
-d"SolutionDir=*Undefined if not building a solution or within Visual
Studio*" -d"SolutionExt=*Undefined if not building a solution or within
Visual Studio*" -d"SolutionFileName=*Undefined if not building a solution or
within Visual Studio*" -d"SolutionName=*Undefined if not building a solution
or within Visual Studio*" -d"SolutionPath=*Undefined if not building a
solution or within Visual Studio*" -dConfiguration=Release
-dOutDir=bin\x64\Release\ -dPlatform=x64 -d"ProjectDir=C:\StarTeam
Projects\n-knowledgecentre-kc-tools-PandD\Deployment\kCTools.Deploy\\"
-dProjectExt=.wixproj -dProjectFileName=kCTools.Deploy.wixproj
-dProjectName=kCTools.Deploy -d"ProjectPath=C:\StarTeam
Projects\n-knowledgecentre-kc-tools-PandD\Deployment\kCTools.Deploy\kCTools.Deploy.wixproj"
-d"TargetDir=C:\StarTeam
Projects\n-knowledgecentre-kc-tools-PandD\Deployment\kCTools.Deploy\bin\x64\Release\\"
-dTargetExt=.msi -dTargetFileName=kCTools.Deploy.msi
-dTargetName=kCTools.Deploy -d"TargetPath=C:\StarTeam
Projects\n-knowledgecentre-kc-tools-PandD\Deployment\kCTools.Deploy\bin\x64\Release\kCTools.Deploy.msi"
-out obj\x64\Release\SP.DeployComponents.wixobj -arch x64 -ext "C:\Program
Files\Windows Installer XML v3\bin\WixUtilExtension.dll" -ext "C:\Program
Files\Windows Installer XML v3\bin\WixUIExtension.dll" -ext "C:\Program
Files\Windows Installer XML v3\bin\WixIIsExtension.dll"
SP.DeployComponents.wxs
    Microsoft (R) Windows Installer Xml Compiler version 3.0.4805.0
    Copyright (C) Microsoft Corporation. All rights reserved.

    SP.DeployComponents.wxs

however, if the WiX project already exists locally, and nothing has changed,
and I run MSBuild against the WiX project, I get this output:

Target Compile:
  Skipping target "Compile" because all output files are up-to-date with
respect to the input files.

Hmm .. I guess that "Skipping target Compile" means the WiX preprocessing
never runs (just dawned on me) .. doh!

So, to conclude, I will be setting the environment variable to null at the
end of my build script, and, at the beginning of the script I will be
deleting the WiX Project.

Make sense?

- Troy

On Sat, Jul 25, 2009 at 2:14 PM, Bob Arnson <b...@joyofsetup.com> wrote:

> troy hostetter wrote:
> > error CNDL0150: Undefined preprocessor variable
> > '$(env.Install_Environment)'.
> >
>
> Use <?ifdef?> first to see if it's defined. Don't use $() around it in
> an <?ifdef?>.
>
> --
> sig://boB
> http://joyofsetup.com/
>
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to