This project is read-only.

Integration with VS Setup

Dec 31, 2009 at 5:50 PM
Edited Jan 4, 2010 at 3:30 PM

I read this info:

Integration with Visual Studio Setup Projects

Add a custom page with two text boxes to the installer's UI to collect the settings file name into a property named SETTINGSFILE, and optionally additional custom properties into a property named CUSTOMSETTINGS

Add the XmlPreprocess.exe file to the installer

Add a custom action that invokes XmlPreprocess.exe with the appropriate command line parameters, for example:



1) Wouldn't the user also have to indicate which column to use from the SettingsFile?  I.e. Dev, QA, Prod?

I currently have a install dialog box with four radio buttons representing the four enviornments.

I was trying to figure this out on my own, would this work:


where ENVIRONMENTBUTTON is the name of my radio button(s).  I'll give it a try and see.

I added a custom actionunder "Install", and set the argument property to this:


When I run the MSI, I get this error:

Error 1001: Error encountered preprocessing --> Value cannot be null.  Parameter name: path

This was finally solved by setting the property "Condition" to True.

The next hitch was that the /settingNameCol has to be a number, so I will change values of my buttons.

I decided to test from command line until I saw the substitution working, so created a test.cmd with this contents:

xmlpreprocess.exe /s "c:\Source\TFBIC.RCT.BizTalk\TFBIC.RCT.BizTalk.Deployment\EnvironmentSettings\SettingsFileGenerator.xml" /i "web.config" /settingNameCol:3

Still testing ... time to break for the end of 2009.

Neal Walters



Jan 4, 2010 at 7:37 PM

I did some stand-alone tests as described here:

That's working fine, but still don't get the expected results now in my MSI results. 

The biggest question I have, is how to debug when things don't work?  Can I redirect the console output somewhere?

I tried settings my arguments like this:


Here's portions of my output web.config:

<!-- #ifdef _xml_preprocess -->
     <!-- <add key="Environment" value="${_environment_name}" /> -->
  <!-- #else -->
  <add key="Environment" value="" />
  <!-- #endif -->


<!-- #ifdef _xml_preprocess -->
  <!--    <add key="ConnectionString:BizTalkMgtDb"
    value="server=${SQLSERVER};database=BizTalkMgmtDb;Trusted_Connection=yes;Integrated Security=SSPI;Persist Security Info=False" />
  <add key="ConnectionString:ESBSupport"
     value="Data Source=${SQLSERVER};Initial Catalog=ESBSupport;Persist Security Info=False;Integrated Security=True"  />
  <!-- #else -->
  <add key="ConnectionString:BizTalkMgtDb"
   value="server=(local);database=BizTalkMgmtDb;Trusted_Connection=yes;Integrated Security=SSPI;Persist Security Info=False" />
  <add key="ConnectionString:ESBSupport"
            value="Data Source=(local);Initial Catalog=ESBSupport;Persist Security Info=False;Integrated Security=True"  />  <!-- #endif -->


So I'm suspecting that either XMLPreprocess did not run, or it run and had errors - and I don't know how to view the errors.

I noticed that I get the exact same results if I supply an non-existing filename for SETTINGSFILE (when the MSI prompts me).
Is there anyway to avoid or notify user of a mistyped/non-existant filename? 
Maybe the MSI installer has a file-picker instead of just letting them type (or copy/paste) the filename?

Neal Walters



Jan 4, 2010 at 8:43 PM

Ok, I'm clearly learning as I go here.  Setting the Condition=True basically caused the XmlPreprocess.exe not to run.

If I set the "Condition" property back to no value, or put in value of "Not Installed", then I'm back to earlier error:

Error 1001: Error encountered preprocessing --> Value cannot be null.  Parameter name: path



Jan 4, 2010 at 9:17 PM

Here's my last attempt:

I set "Installer Class" to False, which allows me to specify the following parms in "CustomActionData" instead of "Arguments".


Now when it runs, I see the command prompt window "whisking" by - with no time to read it, then I get this error:

"There is a problem with this Windows Installer package.  A program run as part of the setup did not finish as expected.  Contact your support personnel or package vendor." 

I am the "support personnel" and don't know what to try next.  I'd love to see the command prompt screen or route it a disk file.

I tried this - but no disk file created:




Jan 6, 2010 at 5:15 PM
Edited Jan 6, 2010 at 5:15 PM

Hello, is anybody there?

Latest debugging:



Jan 12, 2010 at 3:42 PM


I'm so sorry I haven't been receiving any notifications on these discussions, and I never think to check.

I'm 100% a WiX guy now for my setups, and it's been many many years since I had to work with VDPROJ's, and as I remember, I did NOT enjoy them.  Have you considered delivering a batch file, XmlPreprocess and your spreadsheet to a subdirectory of your application, then invoking the batch file with a custom action?

If you have a batch file, it seems like it might be easier to test & redirect output etc...rather than executing XMLPreprocess directly, for testing you could even throw a pause in there.  Just a thought.  Of course it litters your application folder with some perhaps unwanted items after install has completed, but for internal applications, or server-based applications, this may be acceptable. Or I suppose you could delete them at the end of the configuration step.

WiX has a custom action that captures the console output and sticks it directly into the verbose MSI log, so that's what I use.


Jan 12, 2010 at 6:46 PM
Edited Jan 12, 2010 at 6:50 PM

Ok thanks.   You might want to see my post of confusion of new technologies here:

How long will it take to get up to speed on WiX?  Can a person go from zero to building a web service MSI in one day?  Or probably 2 or 3?

My point here is that I believe I followed your instructions in this page:
and it didn't work.  I could have messed up, but it seemed logical and simple.  I think the biggest issue is what to do when you get errors.  Which, as I believe you are saying, is not the .vdproj/MSI strong suit.


Neal Walters


Jan 12, 2010 at 9:25 PM

Ok, I'm trying WIX.   About 3 hours so far.


     <CustomAction Id="SAMPLE_CONFIG" BinaryKey="XMLPREPROCESS" ExeCommand="/i:&quot;[INSTALLLOCATION]web.config&quot; /x:&quot;[INSTALLLOCATION]SettingsFileGenerator.xml&quot; /e:QA /d:ServiceLocation=[SERVICELOCATION]" Execute="deferred" />
        <Binary Id="XMLPREPROCESS" SourceFile="../TFBIC.RCT.WCFWebServices/RequiredBins/XMLPreprocess.exe" />
            <Custom Action="SAMPLE_CONFIG" After="StartServices"><![CDATA[NOT Installed]]></Custom>


Install log shows this:

Action 15:22:27: StartServices. Starting services
Action start 15:22:27: StartServices.
MSI (s) (58:CC) [15:22:27:898]: Note: 1: 2205 2:  3: ServiceControl
MSI (s) (58:CC) [15:22:27:898]: Note: 1: 2228 2:  3: ServiceControl 4: SELECT `Name`,`Wait`,`Arguments`,`Event`, `Action` FROM `ServiceControl`, `Component` WHERE `Component_` = `Component` AND (`Action` = 0 OR `Action` = 1 OR `Action` = 2)
Action ended 15:22:27: StartServices. Return value 1.
MSI (s) (58:CC) [15:22:27:899]: Doing action: SAMPLE_CONFIG
Action 15:22:27: SAMPLE_CONFIG.
Action start 15:22:27: SAMPLE_CONFIG.
Action ended 15:22:27: SAMPLE_CONFIG. Return value 1.


How do I turn it on to show everything in the install log as you mentioned?




Jan 14, 2010 at 1:25 AM

I've been using the CAQuietExec option like this: 

        <CustomAction Id="ConfigureApp_Cmd" Property="ConfigureApp" Execute="immediate"
             Value="&quot;[INSTALLDIR]Environments\ConfigureClient.cmd&quot; &quot;[ENVIRONMENT]&quot;" />
        <CustomAction Id="ConfigureApp" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" Impersonate="no"/>

            <Custom Action="ConfigureApp_Cmd" After="StartServices"><![CDATA[NOT(Installed) AND (ENVIRONMENT <> "") AND (ENVIRONMENT <> "(none)")]]></Custom>
            <Custom Action="ConfigureApp" After="ConfigureApp_Cmd"><![CDATA[NOT(Installed) AND (ENVIRONMENT <> "") AND (ENVIRONMENT <> "(none)")]]></Custom>


Jan 15, 2010 at 4:19 PM

Here's what I ended up using, along with some comments that might be helpful to anyone who tries this.  I was using version 3.5 of WIX.

It was very picky about how you put the &quot; symbols around the cmdline.

        There is a documentation mistake in WiX3 chm, you need to replace the
        Id="wixca" with Id="WixCA and remove the Binary element.
        Then you will need to add VStudio reference to WixUtilExtension.

        Property name msut be: QtExecCmdLine  for immediate;  QtExecDeferred for deferred
        the value must begein with a "quoted application name",
        if you see this error: 80070002 it means "file not found".
        <Property Id="VerifyCurrentPropValueOfEnv" Value="[VARRADIOBUTTONENVIRONMENT]"/>
        <Property Id="QtExecCmdLine" Value="&quot;[INSTALLLOCATION]XmlPreprocess.exe&quot; /i:&quot;[INSTALLLOCATION]web.config&quot; /x:[VARTEXTSETTINGSFILENAME] /e:[VARRADIOBUTTONENVIRONMENT]"/>
        <CustomAction Id="QtExec1" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="check"/>

        <Custom Action="QtExec1" After="InstallFinalize"><![CDATA[NOT(Installed)]]></Custom>


Neal Walters