Tuesday, May 24, 2011

.wdproj fails to copy down .refresh binaries

So I have recently been put on a team that utilizes web site projects and hooking up build automation.

Apparently the default target for copying down .dll.refresh files does in
C:\Program Files\MSBuild\Microsoft\WebDeployment\v10.0
this for its copy inside the _ResolveReferences target:

 <Copy 
      SourceFiles="@(References->'%(FullPath)')" 
      DestinationFolder="$(_FullSourceWebDir)\Bin\" 
      Condition="!Exists('%(References.Identity)')" 
      ContinueOnError="true"
      SkipUnchangedFiles="true"
      Retries="$(CopyRetryCount)"
      RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>

and References.Identity resolves to the source identity, not the target identity. So if the source exists it will not copy.

To work around it, and in case in some other usages for this target need this functionality I added a custom beforebuild override in my .wdproj file:

<Target Name="BeforeBuild">
  <Message Text="Doing custom BeforeBuild" />
<Copy 
      SourceFiles="@(References->'%(FullPath)')" 
      DestinationFolder="$(_FullSourceWebDir)\Bin\" 
      ContinueOnError="true"
      SkipUnchangedFiles="true"
      Retries="$(CopyRetryCount)"
      RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
</Target>

1 comment:

  1. This was exactly the thing I was looking for, thank you so much! :-)

    ReplyDelete