views:

23

answers:

2

Hi,

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

A: 

You are missing the PropertyGroup that injects that target into the build. You should include that as well, I suspect that this target is not executing so they never get added. Also you might want to keep an eye on my blog because there is a simpler way to do this, I will blog it soon when I have time.

Sayed Ibrahim Hashimi
Sayed, thanks but the target does get executed as I'm seeing the messages `AppBuildFolder = c:\myfolder` and `Files found: ` (but nothing displayed). Is there something I can do to get this working right now so that I can hit our deadline? I suspect my issue is not having the correct format for the `Include` in `_CustomFiles` to work, because otherwise this is a copy and paste from your blog. :-)
Andy
If the message is 'Files found: ' then you have not created the Include declaration for that correctly. You need to get that part working otherwise its not going to work because you will not be adding anything to the FilesForPackagingFromProject item list.
Sayed Ibrahim Hashimi
A: 

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.

Andy