build automation - TFS 2010 built, drop location local not unc share -


i have wanted copy built files on release built local directory, not unc share. have written activity wanted so:

    using system.activities; using system.io; using system.linq; using microsoft.teamfoundation.build.client;  namespace custombuiltactivities {     /// <summary>     ///     activity helps copy directory one. integrated in teamfoundation built activities supporting     ///     copy unc share, small helper activity need copying files local directory.     /// </summary>     [buildactivity(hostenvironmentoption.agent)]     public sealed class copydirectorylocal : codeactivity     {         [requiredargument]         public inargument<string> destinationdirectory { get; set; }          [requiredargument]         public inargument<string> sourcedirectory { get; set; }          protected override void execute(codeactivitycontext context)         {             var destination = context.getvalue(destinationdirectory);             var source = context.getvalue(sourcedirectory);             copyrecursive(source, destination);         }          private static void copyrecursive(string sourcedirectory, string destinationdirectory)         {             if (!directory.exists(sourcedirectory))                 throw new directorynotfoundexception(sourcedirectory);             try             {                 directory.createdirectory(destinationdirectory);             }             catch             {             }             directory.getdirectories(sourcedirectory).tolist().foreach(                 sourcedir =>                     {                         var dirname = sourcedir.substring(sourcedir.lastindexof("\\"));                         copyrecursive(sourcedir, destinationdirectory+"\\"+dirname);                     });             directory.getfiles(sourcedirectory).tolist().foreach(                 sourcefile =>                     {                         var filename = new fileinfo(sourcefile).name;                         file.copy(sourcefile, string.concat(destinationdirectory, "\\", filename));                     }                 );         }     } } 

but activity fails , let me know directory not found. how fix it? need customization getting seperat folders in binaries manually out there.

thx help, michael baarz

why not use unc path based on localhost?

\localhost\mydir

or even

\localhost\c$\mydir

if want proceed custom activity, pretty easy debug. execute code in unit test (or eg console app) specified values. sure source directory exists when start activity? add additional checks (such directory.exists) in code. debug code http://www.ewaldhofman.nl/post/2010/10/01/customize-team-build-2010-e28093-part-12-how-to-debug-my-custom-activities.aspx


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -