【问题标题】:MSB3073 'command' exited with code 9009MSB3073“命令”以代码 9009 退出
【发布时间】:2014-05-08 22:17:03
【问题描述】:

每当我执行此命令时,它都会抛出错误 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

我该怎么办?

【问题讨论】:

    标签: msbuild wix command-prompt


    【解决方案1】:

    也许您在WixPath 中有空格?尝试添加引号:

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

    【讨论】:

      【解决方案2】:

      当我将 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。

      【讨论】:

        【解决方案3】:

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

        &lt;Exec Command="$(SystemRoot)\foo bar" /&gt;

        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.
        

        【讨论】:

          【解决方案4】:

          cmd 的退出代码 9009 基本上意味着“找不到命令”。换句话说,$(WixPath)heat 没有指向可执行文件,这可能是因为我在显示的代码中的任何地方都没有看到属性 WixPath。调试此问题的一种快速方法是使用与Exec 具有相同参数的Message 任务,这样您就可以准确地看到正在尝试执行的内容。

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

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

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 2016-09-10
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2016-11-29
            相关资源
            最近更新 更多