2014-03-29 193 views
11

每當我執行此命令時,它拋出錯誤MSB3073代碼爲9009MSB3073「命令」退出,代碼爲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 

我該怎麼辦?

回答

14

從cmd退出代碼9009基本上意味着'command not found'。換句話說$(WixPath)heat沒有指向可執行文件,這可能是因爲在代碼中顯示的任何地方都沒有看到屬性WixPath。快速調試此方法的方法是使用與Exec相同的Message任務,以便您可以準確查看要執行的操作。

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

將輸出粘貼到命令行上,運行它並檢查它是否執行。

/v:diag /fl到了冗長和登錄到 msbuild.log文件
0

運行,找到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. 
8

我改變了命令,如下圖所示,因爲我用VS2010與維克斯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="." /> 
相關問題