MSB3073 'command' 以代码9009退出

14
每当我执行此命令时,它都会抛出错误代码为 9009 的 MSB3073 错误。
$(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个回答

20

从cmd返回的退出代码9009基本上意味着“找不到命令”。换句话说,$(WixPath)heat没有指向可执行文件,这可能是因为代码中没有看到属性WixPath的存在。一种快速调试的方法是使用一个带有与Exec相同参数的任务,以便您可以查看要执行的内容。

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

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


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。

3
也许你的 WixPath 中有空格?尝试添加引号:
<Exec Command='&quot;$(WixPath)heat&quot; ...'
    ContinueOnError="false"
    WorkingDirectory="." />

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.

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接