I have a very odd issue, where I've created a custom MSBuild task that would move all files I need for my MVC project to a specific location so that we can publish it. This works fine when I trigger the script localy on my machine but as soon as I check this changes in and Teamcity runs the script, it copies everything except from the Bin folder. However, if run MSbuild directlly from the command line (same script), it does copy the bin folder. I don't understand why this isn't working when TeamCity is building it.
Does anyone have an idea why this is happening and how to solve it?
<Target Name="AfterBuild">
<CallTarget Targets="Move" />
</Target>
<Target Name="Move">
<Copy SourceFiles="@(BinFolder)" DestinationFolder="$(ArtifactsDir)\Webproject.Web\bin" />
<Copy SourceFiles="@(ContentFolder)" DestinationFolder="$(ArtifactsDir)\SchrodersFundEngine.Web\Content" />
<Copy SourceFiles="@(ImagesFolder)" DestinationFolder="$(ArtifactsDir)\SchrodersFundEngine.Web\Images" />
<Copy SourceFiles="@(ScriptsFolder)" DestinationFolder="$(ArtifactsDir)\SchrodersFundEngine.Web\Scripts" />
</Target>
<ItemGroup>
<BinFolder Exclude="*.cs" Include="$(ProjectDir)bin\**\*.*"/>
<ContentFolder Exclude="*.cs;*.svn-base" Include="$(ProjectDir)Content\*.css"/>
<ImagesFolder Exclude="*.cs;*.svn-base" Include="$(ProjectDir)Images\*.*"/>
<ScriptsFolder Exclude="*.cs;*.svn-base" Include="$(ProjectDir)Scripts\*.js"/>
</ItemGroup>
$(ArtifactsDir) is a paramanter I'm passing in from Teamcity & manually in the command line.
/p:ArtifactsDir="%system.agent.work.dir%\WebProject\trunk\Website"