2011-02-18 67 views
0

我試圖創建一個msbuild腳本,它將編譯並將測試應用程序放置到桌面上的文件夾中。我不希望這個應用程序發佈到IIS。我跟蹤了幾個blgos,並通過hashimi的書看,但我仍然無法弄清楚這一點。以下是我的腳本。非常感謝你!Msbuild編譯網站時未將網站置於IIS中

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <Target Name="Clean"> 
    <ItemGroup> 
     <BinFiles Include="bin\*.*" /> 

    </ItemGroup> 
    <Delete Files="@(BinFiles)" /> 
    </Target> 
    <Target Name="Compile" DependsOnTargets="Clean"> 
    <MSBuild Projects="test.vbproj"/> 
    </Target> 
    <Target Name="Publish" DependsOnTargets="Compile"> 
    <RemoveDir Directories="$(OutputFolder)" 
    ContinueOnError="true"/> 
    <MSBuild Projects="test.vbproj" 
      targets="ResolveReferences;_CopyWebApplication" 
      Properties="WebProjectOutputdir=$(OutputFolder; OutDir=$WebProjectOutputDir)\"/> 
      </Target> 
    </Target> 
</Project> 

回答

0

你的腳本有點尷尬(你重新定義了乾淨的目標和基本的乾淨目標一樣)。

我很確定你的問題來自CopyWebApplication,它根據在你的項目文件中設置的屬性並通過命令行進行大量的工作。

你可以試試下面的腳本:

<Project DefaultTargets="Compile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <Target Name="Compile"> 
    <MSBuild 
     Projects="test.vbproj" 
     Targets="Clean;Build" 
     Properties="OutputPath=C:\tmp"/>  
    </Target> 
</Project> 

如果您的測試項目是一個網站,那麼構建目標應在OutputPath/OUTDIR財產

+0

該工程中指定的文件夾中創建它!非常感謝 – gh9 2011-02-21 19:45:13