views:

201

answers:

1

I have the below function as a part of my psake build. When the build is executing Candle.exe throws this error:

candle.exe : warning CNDL1098: 'ext .\Build\Packages\WixWeb\bin\WixIIsExtension.dll' is not a valid command line argument.

I think this is a problem with the way I am passing command line args but I cannot for the life of me figure it out.

Any powershell monkeys have suggestions?

function buildMsi($build_dir, $template, $directory) { 
    "Building Msi" 
    "Build Folder: $build_dir"
    "Wix Template: $template"
    "Website: $directory"

    $wixXml = [xml](Get-Content $template)
    $namespaceManager = New-Object Xml.XmlNamespaceManager($wixXml.PSBase.NameTable)
    $namespaceManager.AddNamespace("wi", "http://schemas.microsoft.com/wix/2006/wi")
    $components = $wixXml.Wix.Fragment.ComponentGroup

    WalkDirectory $wixXml.PSBase.SelectSingleNode("/wi:Wix/wi:Fragment/wi:DirectoryRef", $namespaceManager) $directory
    $wixXml.Save("$build_dir\WebContent.wxs")

    .\Build\WixWeb\bin\Candle.exe """-dProductName=Foo""`
      ""-dVersion=1.0.0.0""`
      ""-dProductID=0cd64670-5769-4e34-8b21-c6242e7ca5a2""`
      ""-dUpgradeCode=307601e9-4eea-4b5c-938a-354115d5c419""`
      ""-dAppPool=FooAppPool""`
      ""-dInstallDirectory=Foo""`
      ""-dWebAppDirectoryComponentId=CF57E626-1E95-4a89-A0E9-C1AD03C51B12""`
      ""-dIIsAppPoolComponentId=D9138380-19B3-4123-9E22-AB2994B1024B""`
      ""-dIIsWithAppPoolSettingsComponentId=02ca3f08-a1e8-48a3-b4d7-6f5f67c61b96""`
      ""-dIIsWithoutAppPoolSettingsComponentId=d97791b0-f597-46c6-b159-541817527453""`
      ""-ext "".\Build\WixWeb\bin\WixIIsExtension.dll""""`
      ""-ext "".\Build\WixWeb\bin\WixUIExtension.dll""""`
      "".\Build\WixWeb\Shell.wxs""`
      "".\Build\stage\WebContent.wxs"" "

}
+2  A: 

Try replacing your inner double quotes with single quotes, like so:

.\Build\WixWeb\bin\Candle.exe " ""-dProductName=Foo"" `
     ""-dVersion=1.0.0.0"" `
     ""-dProductID=0cd64670-5769-4e34-8b21-c6242e7ca5a2"" `
     ""-dUpgradeCode=307601e9-4eea-4b5c-938a-354115d5c419"" `
     ""-dAppPool=FooAppPool"" `
     ""-dInstallDirectory=Foo"" `
     ""-dWebAppDirectoryComponentId=CF57E626-1E95-4a89-A0E9-C1AD03C51B12"" `
     ""-dIIsAppPoolComponentId=D9138380-19B3-4123-9E22-AB2994B1024B"" `
     ""-dIIsWithAppPoolSettingsComponentId=02ca3f08-a1e8-48a3-b4d7-6f5f67c61b96"" `
     ""-dIIsWithoutAppPoolSettingsComponentId=d97791b0-f597-46c6-b159-541817527453"" `
     ""-ext '.\Build\WixWeb\bin\WixIIsExtension.dll'"" `
     ""-ext '.\Build\WixWeb\bin\WixUIExtension.dll'"" `
     "".\Build\WixWeb\Shell.wxs"" `
     "".\Build\stage\WebContent.wxs"" "

Futhermore, you might find it easier if you escape your double quotes correctly using `" (backtick followed by doublequote); the script might be more robust, too. The code sample would then become:

.\Build\WixWeb\bin\Candle.exe " `"-dProductName=Foo`" `
 `"-dVersion=1.0.0.0`" `
 `"-dProductID=0cd64670-5769-4e34-8b21-c6242e7ca5a2`" `
 `"-dUpgradeCode=307601e9-4eea-4b5c-938a-354115d5c419`" `
 `"-dAppPool=FooAppPool`" `
 `"-dInstallDirectory=Foo`" `
 `"-dWebAppDirectoryComponentId=CF57E626-1E95-4a89-A0E9-C1AD03C51B12`" `
 `"-dIIsAppPoolComponentId=D9138380-19B3-4123-9E22-AB2994B1024B`" `
 `"-dIIsWithAppPoolSettingsComponentId=02ca3f08-a1e8-48a3-b4d7-6f5f67c61b96`" `
 `"-dIIsWithoutAppPoolSettingsComponentId=d97791b0-f597-46c6-b159-541817527453`" `
 `"-ext '.\Build\WixWeb\bin\WixIIsExtension.dll'`" `
 `"-ext '.\Build\WixWeb\bin\WixUIExtension.dll'`" `
 `".\Build\WixWeb\Shell.wxs`" `
 `".\Build\stage\WebContent.wxs`" "

YMMV, though.

alastairs
same error, good suggestion though.
NotMyself
Using the single quotes or the escaped double quotes? Or both?
alastairs
its very strange its like it is dropping the - off of the -ext param
NotMyself
According to http://wix.sourceforge.net/manual-wix3/extension_usage_introduction.htm you can drop the path and .dll extension, as the extensions are in the same location as Candle.
alastairs
I think the error output missing the - from -ext is by design. The name of the argument is "ext" not "-ext"; additionally, if PowerShell were doing this, I would expect it to bork on the first -d arguments.
alastairs
tried both, removing the two lines allows it to execute but my wix scrit fails obviously.. 8)
NotMyself
yeah still no dice:candle.exe : warning CNDL1098: 'ext 'WixIIsExtension' ' is not a valid command line argument.candle.exe : warning CNDL1098: 'ext 'WixUIExtension' ' is not a valid command line argument.
NotMyself
Random thought: what if you stick a space between each of the command-line switches and their values. E.g. "-d ProductName=Foo", etc.
alastairs
using echoargs.exe it looks like the params are coming in correctly. Arg 10 is <-ext WixIIsExtension > Arg 11 is <-ext WixUIExtension >
NotMyself
Try dropping the single quotes around the parameter to the -ext argument, so the lines read: `"-ext .\Build\WixWeb\bin\WixIIsExtension.dll`" `It's a bit risky, but as you don't have any spaces or other funny characters in your path, it should be ok.
alastairs
Errr, the formatting of that comment got screwed up. There should be backticks before each double-quote.
alastairs