简体   繁体   中英

Copy files from MSBuild folder to Output folder using Powershell

Using TFS 2013 and I have files that show up in the c:\\builds location that need to be copied over to the build output folder once the build is complete. Would like to use powershell to accomplish this while using the TfvcTemplate.12 .

Below is the closest thing I could find as a reference, but I'm not familiar with powershell, or how to point the $SrcDir and $DestDir to the c:\\builds folder since it is never the same or the output folder since it changes as well.

http://www.codeproject.com/Tips/642297/File-copy-using-Microsoft-Powershell

I use PowerShell quite a bit in my TeamBuild 2012 (customized) workflow. You need to create an InvokeProcess activity. Set it to start PowerShell.exe. I pass in arguments like:

"-NoProfile -NonInteractive -Command ""& {" + SourcesDirectory + "\Common\Build\AuthenticodeSignFiles.ps1 '" + outputDirectory + "'" + " -Verbose:" + PowerShellVerboseSwitchValue + "}"""

TeamBuild defines SourcesDirectory, BinariesDirectory and DropLocation which you can pass to PowerShell. The "Compile and Test for Configuration" activity defines the variable outputDirectory which is updated for each config|platform combo it builds.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM