Andy
Andy

Reputation: 8562

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

Upvotes: 0

Views: 1982

Answers (2)

Andy
Andy

Reputation: 8562

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.

Upvotes: 1

Sayed Ibrahim Hashimi
Sayed Ibrahim Hashimi

Reputation: 44322

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.

Upvotes: 0

Related Questions