2

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?

DotnetDude
  • 11,617
  • 35
  • 100
  • 158

1 Answers1

3

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
  • 12,688
  • 3
  • 39
  • 44
  • 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 Sep 22 '10 at 18:58
  • 1
    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 Sep 22 '10 at 19:52
  • I understand how to create a custom activity. I am not sure how to run a command line command from C# code – DotnetDude Sep 22 '10 at 20:32
  • 1
    You can use the ProcessStartInfo for that: http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.aspx – Ewald Hofman Sep 22 '10 at 20:56
  • @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 Sep 24 '10 at 18:28
  • 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 Sep 24 '10 at 18:41