Currently I have set up a Web Deployment Project which compiles code into the .\Release
folder. After the build I want to copy the files over to another machine (because whichever directory you build to is deleted then recreated).
The ItemGroup for defining which files to copy is set up as follows:
<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<ReleaseFiles Include=".\Release\**\*" />
<OverrideFiles Include="..\website\App_Code\override\site.com\**\*" />
</ItemGroup>
'website' is code that is used for multiple sites, so there are several web deployment projects set up within the solution.
Then, I have the AfterBuild target to copy the files:
<Target Name="AfterBuild" Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Copy SourceFiles="@(ReleaseFiles)" ContinueOnError="true" SkipUnchangedFiles="true" DestinationFiles="@(ReleaseFiles->'\\server\web\site.com\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(OverrideFiles)" DestinationFiles="@(OverrideFiles->'\\server\web\site.com\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
However, the ReleaseFiles aren't copied, what can be the cause of that? I have had the error .\TempBuildDir\folder\subfolder - The process cannot access the file because it is being used by another process.
where folder\subfolder
can be different each time, but even when that message doesn't appear the files still aren't copied.
Problem is, it has worked before.