MSBuild Target Order Not Obeyed When using _CopyWebApplication

TeamCity 4.5. Building C#/MVC App .Net 3.5

For my targets I have Clean;Build;ClearWebProjectDirectory;_CopyToWebApplication

I defined parameters required including WebProjectOutDir=c:\inetpub\integration\\wwwroot\

ClearWebProjectDirectory Task is:

<Target Name="ClearWebProjectDirectory" Condition="'$(WebProjectOutputDir)'!=''">
    <Message Text="Clearing up web project directory"/>
            <WebAppFiles Include="$(WebProjectOutputDir)\**\*.*" />
        <Delete Files="@(WebAppFiles)" Condition="'$(WebProjectOutputDir)' != ''" />
    <Message Text="Cleared up web project directory"/>

I think the problem with Teamcity's patch (or it maybe msbuild itself - or my lack of understanding) is that its not obeying the targetting order.

ClearWebProjectDirectory always runs last as indicated in the logs looking fo Message tasks output.Which of course causes problems since its clearing out the newly copied content.


1 comment
Comment actions Permalink

Figured it out, it does _CopyWebApplication runs automatically after build if WebProjectOutputDir parameter is defined. And it doesnt call the task twice (presumably this is intended msbuild behaviour right)

So not related to TC build script modifications, but out of interest what the hell are they needed for?


Please sign in to leave a comment.