views:

81

answers:

1

I'd like to run a command to execute a subversion command from the TFS custom activity. Should I create a msbuild script to exec the svn command and call msbuild from the activity?

Thanks. Anyone?

+1  A: 

You can also add an InvokeProcess activity to the build process template.

See http://www.ewaldhofman.nl/?tag=/build+2010+customization for more information on how to modify the build process template.

Ewald Hofman
It appears that InvokeProcess can run a batch file. In my case, all I need to run is a simple command and do a bunch of other things that's perfect for a custom activity. Is there a way to do this within the activity (powershell maybe)?
DotnetDude
You can call a powershell script also from the InvokeProcess. You can also create a custom CodeActivity to perform your actions. In my blog posts you can find how you can create a custom CodeActivity.
Ewald Hofman
I understand how to create a custom activity. I am not sure how to run a command line command from C# code
DotnetDude
You can use the ProcessStartInfo for that: http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.aspx
Ewald Hofman
@Ewald - Thanks for pointing me in the right direction. I ended up createing a MSBuild script and calling it from MSBuild activity. It works fine except that the MSBuild script attempts to copy some files to the Build directory and it fails with a unable to access error. My guess is that the main TFS build is holding a lock on the directory while MSBuild runs and tries to copy files there. Any thoughts on resolving this issue? Thanks
DotnetDude
Setting a lock would not be the problem. I think that the credentials you run the code under has no access to the directory. You can isolate this by giving everyone Full Access to the Build directory.
Ewald Hofman