MSB3073'命令'退出代码9009

时间:2014-03-29 10:43:44

标签: msbuild wix command-prompt

每当我执行此命令时,它都会抛出错误MSB3073,代码为9009

$(WixPath)heat dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg DatoCheckerWebComponents -var var.publishDir -gg -out $(WebSiteContentCode)

整个构建文件在这里:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <WebSiteSource>..\DatoCheckerMvc\</WebSiteSource>
        <SetupF>..\Setup\</SetupF>
        <PublishF>publish\</PublishF>
        <Publish>$(SetupF)$(PublishF)</Publish>
        <WebSiteContentCode>WebSiteContent.wxs</WebSiteContentCode>
    </PropertyGroup>

    <!-- Defining group of temporary files which is the content of the web site. -->
    <ItemGroup>
        <WebSiteContent Include="$(WebSiteContentCode)" />
    </ItemGroup>

    <!-- The list of WIX input files -->
    <ItemGroup>
        <WixCode Include="Product.wxs" />
        <WixCode Include="$(WebSiteContentCode)" />
    </ItemGroup>

    <Target Name="Build">
        <!-- Compile whole solution in release mode -->
        <MSBuild
            Projects="..\DatoCheckerMvc.sln"
            Targets="ReBuild"
            Properties="Configuration=Release" />
    </Target>

    <Target Name="PublishWebsite">
        <!-- Remove complete publish folder in order to be sure that evrything will be newly compiled -->
        <Message Text="Removing publish directory: $(SetupF)"/>
        <RemoveDir Directories="$(SetupF)" ContinueOnError="false" />
        <Message Text="Start to publish website" Importance="high" />
        <MSBuild
            Projects="..\\DatoCheckerMvc\DatoCheckerMvc.csproj"
            Targets="ResolveReferences;_CopyWebApplication"
            Properties="OutDir=$(Publish)bin\;WebProjectOutputDir= $(Publish);Configuration=Release" />
    </Target>

    <Target Name="Harvest">
        <!-- Harvest all content of published result -->
        <Exec Command='$(WixPath)heat dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg DatoCheckerWebComponents -var var.publishDir -gg -out $(WebSiteContentCode)'
            ContinueOnError="false"
            WorkingDirectory="." />
    </Target>
</Project>

我用来调用此版本的命令是:

 msbuild /t:Build;PublisWebsite;Harvest setup.build

我应该做什么?

4 个答案:

答案 0 :(得分:17)

cmd退出代码9009基本上意味着找不到&#39;命令。换句话说,$(WixPath)heat并不指向可执行文件,这可能是因为我在所显示的代码中的任何位置都看不到属性WixPath。调试此方法的一种快速方法是使用与Message具有相同标准的Exec任务,以便您可以确切地看到尝试执行的内容。

<Message Text='$(WixPath)heat dir $(Publish) -dr INSTALLFOLDER ....'/>

将输出粘贴到命令行,运行它并检查它是否执行。

答案 1 :(得分:7)

我改变了下面的命令,因为我使用VS2010和Wix 3.8并且它有效。

Command='"$(WiX)bin\heat.exe" dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg DatoCheckerWebComponents -var var.publishDir -gg -out $(WebSiteContentCode)'

我遇到的问题是找不到以下目录中的heat.exe。

答案 2 :(得分:3)

也许你在WixPath中有空格?尝试添加引文:

<Exec Command='&quot;$(WixPath)heat&quot; ...'
    ContinueOnError="false"
    WorkingDirectory="." />

答案 3 :(得分:0)

使用/v:diag /fl运行详细程度并记录到msbuild.log文件,找到Exec跟踪并确认该命令成功完成,并通过手动运行评估所有参数。所有累积值(系统和用户环境变量,cli覆盖,参数组等)将在转储开始时跟踪(但不记录到文件中),结尾看起来如下所示。

<Exec Command="$(SystemRoot)\foo bar" />

Using "Exec" task from assembly "Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "Exec"
  Task Parameter:Command=C:\Windows\foo bar
  C:\Windows\foo bar
  'C:\Windows\foo' is not recognized as an internal or external command,
  operable program or batch file.
C:\Users\Ilya.Kozhevnikov\Dropbox\foo.build(3,3): error MSB3073: The command "C:\Windows\foo bar" exited with code 9009.