Search code examples
msbuilditemgroup

MSBuild Package task - Web Deploy


I'm trying to add custom files to our web deployment package, per this blog posting: http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx

  <Target Name="CustomCollectFiles">
    <Message Text="AppBuildFolder = $(AppBuildFolder)"/>
    <ItemGroup>
      <_CustomFiles Include="..\*Repository*\**\*.dll;..\*Repository*\**\*.pdb" Condition="'$(AppBuildFolder)' == ''" />
      <_CustomFiles Include="$(AppBuildFolder + '*.dll');$(AppBuildFolder + '*.pdb')" Condition="'$(AppBuildFolder)' != ''" />
      <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>bin\%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
    <Message Text="Files found: @(_CustomFiles)"/>
  </Target>

We have some other references located at AppBuildFolder that we need copied into the package, but I never see any File found outputted in the message. Any ideas?

Thanks Andy


Solution

  • Ok, so the problem was this. We are using Nant's MsBuild task to build the Web Deploy project.

    Apparently, when calling the task like this:

    <msbuild>
      <property name="AppBuildFolder" value="${Some.Path.Ending.In.Backslash}" />
    </msbuild>
    

    MsBuild ends up with this value c:\myfolder". Notice the double quote at the end, instead of c:\myfolder\.

    The fix was to change the <property /> and pass the value using the <arg /> element.

    So, the problem was the MsBuild task in NantContrib.

    Hope this saves somebody else some time.