PostBuild event with sln2008

Hello,

I have recently installed TeamCity 3.1 and am having problems with my build when using a post-build event.

I’ve configured sln2008 on my build runner to compile the solution. This all appears to work fine and all the tests get executed.

However, when I put in a post-build event in one of the projects in the solution (tells to copy this project dll to the web application bin folder), I get an error. Compiling and running from VS2008 works fine, but from TeamCity I get an error, saying

C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3314, 13): error MSB3073:
The command "copy C:\TeamCity\buildAgent\work\e3f031c64e73354c\ C:\TeamCity\buildAgent\work\e3f031c64e73354c\\bin\" exited with code 1. ... where:- = the path of the dll that I am trying to copy ]]> = the path of the web application folder that I am copying the dll to


Can anyone point me in the right direction?

Thanks

10 comments

Could you please check the user account the runs build agent service. Does that user have enough rights to access web application folder?

0

Yep - the user that runs the Build Agent has the correct permissions.

The Build Agent is also doing a clean checkout of files, so this web app folder is part of the build.

I have created a test project to replicate this and the output from the Build Log is below :-




: Target "Build_TeamCity_generated_a7f644186d7c42d48881ad96ba07f0d4" in project "testTeamCity.sln.teamcity.patch.tcprojx" (2s)
: [Target "Build_TeamCity_generated_a7f644186d7c42d48881ad96ba07f0d4" in project "testTeamCity.sln.teamcity.patch.tcprojx"] Project "testTeamCity.sln" (Rebuild target(s)): (2s)
: [Project "testTeamCity.sln" (Rebuild target(s)):] Target "Rebuild" in project "testTeamCity.sln" (2s)
: [Target "Rebuild" in project "testTeamCity.sln"] Project "ExternalProject.csproj" (Rebuild target(s)): (<1s)
: [Project "ExternalProject.csproj" (Rebuild target(s)):] Target "PostBuildEvent" in project "ExternalProject.csproj" (<1s)
: [Target "PostBuildEvent" in project "ExternalProject.csproj"] C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3314, 13): error MSB3073: The command "copy C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\ExternalProject\bin\Release\ExternalProject.dll C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\testTeamCity\bin\ExternalProject.dll" exited with code 1.

: sln2008 output: Copying file from "C:\Program Files\NUnit 2.4.6\bin\nunit.framework.xml" to "bin\Release\nunit.framework.xml". CopyFilesToOutputDirectory:
Copying file from "obj\Release\TestFixtures.dll" to "bin\Release\TestFixtures.dll". TestFixtures -> C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\TestFixtures\bin\Release\TestFixtures.dll Copying file from "obj\Release\TestFixtures.pdb" to "bin\Release\TestFixtures.pdb".
Done Building Project "C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\TestFixtures\TestFixtures.csproj" (Rebuild target(s)).
Project "C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\testTeamCity.sln" (2) is building "C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\testTeamCity\testTeamCity.csproj" (5) on node 0 (Rebuild target(s)).
Creating directory "obj\Release\". PrepareForBuild:
Creating directory "bin\Release\". CopyFilesToOutputDirectory:
Copying file from "obj\Release\testTeamCity.exe" to "bin\Release\testTeamCity.exe". testTeamCity -> C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\testTeamCity\bin\Release\testTeamCity.exe
Copying file from "obj\Release\testTeamCity.pdb" to "bin\Release\testTeamCity.pdb".
Done Building Project "C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\testTeamCity\testTeamCity.csproj" (Rebuild target(s)).
Done Building Project "C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\testTeamCity.sln" (Rebuild target(s)) -- FAILED.
Done Building Project "C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\testTeamCity.sln.teamcity.patch.tcprojx" (Build_TeamCity_generated_a7f644186d7c42d48881ad96ba07f0d4;NUnit_TeamCity_generated_a7f644186d7c42d48881ad96ba07f0d4 target(s)) -- FAILED.

Build FAILED.

"C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\testTeamCity.sln.teamcity.patch.tcprojx" (Build_TeamCity_generated_a7f644186d7c42d48881ad96ba07f0d4;NUnit_TeamCity_generated_a7f644186d7c42d48881ad96ba07f0d4 target) (1) -> "C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\testTeamCity.sln" (Rebuild target) (2) ->
"C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\ExternalProject\ExternalProject.csproj" (Rebuild target) (3) ->

(PostBuildEvent target) ->
C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3314,13): error MSB3073:
The command "copy C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\ExternalProject\bin\Release\ExternalProject.dll C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\testTeamCity\bin\ExternalProject.dll" exited with code 1.

0 Warning(s) 1 Error(s)

Time Elapsed 00:00:02.35
: Process exit code: 1

0

Any ideas guys? Teamcity shouldn't have a problem with Visual Studio build events, should it?

0

Could you please attach you sample project to use. Please attach a screenshot of build configuration as well. Thanks!

0

Does C:\TeamCity\buildAgent\work\b3852d84e6702608\testTeamCity\ExternalProject\bin\Release\ folder exist on the build agent?

0

Attached are the files requested, and yes the directory path you mentioned exists. This is created as part of the build.

I have the solution in TFS and have a VCS set up accordingly

Edited by: beginnerUser on Nov 20, 2008 4:17 PM



Attachment(s):
TeamCity_Screenshots.zip
Test.zip
0

The postbuild event in the properties of the test project is where it fails. Can you recreate it at your end?

0

I have reproduced the issue. In case you run your builds locally you have testTeamCity\bin folder created by VS before the build started. In that case your post build script in ExternalProject succeedes. But in case you start your build under TeamCity no build output folders are created. And copy copy $(TargetPath) $(SolutionDir)testTeamCity\bin\$(TargetFileName) failed.
I have added mkdir $(SolutionDir)testTeamCity\bin command before copy command in that post build event to fix the issue.

Thanks!

0

I have reproduced the issue. In case you run your builds locally you have testTeamCity\bin folder created by VS before the build started. In that case your post build script in ExternalProject succeedes. But in case you start your build under TeamCity no build output folders are created. And copy copy $(TargetPath) $(SolutionDir)testTeamCity\bin\$(TargetFileName) failed.
I have added mkdir $(SolutionDir)testTeamCity\bin command before copy command in that post build event to fix the issue.

Thanks!

]]>

0

Thanks Eugene!

That works perfectly!

0

Please sign in to leave a comment.