{"id":264,"date":"2017-07-20T07:05:44","date_gmt":"2017-07-20T05:05:44","guid":{"rendered":"https:\/\/blog.gerst-it.com\/?p=264"},"modified":"2017-07-20T07:08:02","modified_gmt":"2017-07-20T05:08:02","slug":"tfs-2015-provide-artefacts","status":"publish","type":"post","link":"https:\/\/blog.gerst-it.com\/?p=264","title":{"rendered":"TFS Provide Artefacts"},"content":{"rendered":"<p>Script:<\/p>\n<p>function CopyBinaries($applicationName, $relativeBinarySourcePath)<br \/>\n{<br \/>\nwrite-output &#8222;Create $env:BUILD_ARTIFACTSTAGINGDIRECTORY\\Binaries\\$applicationName&#8220;<br \/>\nNew-Item -ItemType Directory -Force -Path &#8222;$env:BUILD_ARTIFACTSTAGINGDIRECTORY\\Binaries\\$applicationName&#8220;<\/p>\n<p>write-output &#8222;Copy $applicationName Binaries to $env:BUILD_ARTIFACTSTAGINGDIRECTORY\\Binaries\\$applicationName&#8220;<br \/>\nCopy-Item &#8222;$env:BUILD_SOURCESDIRECTORY\\$relativeBinarySourcePath\\*&#8220; &#8222;$env:BUILD_ARTIFACTSTAGINGDIRECTORY\\Binaries\\$applicationName&#8220; -recurse<br \/>\nRemove-Item &#8222;$env:BUILD_ARTIFACTSTAGINGDIRECTORY\\Binaries\\$applicationName\\*.pdb&#8220; -recurse<br \/>\nRemove-Item &#8222;$env:BUILD_ARTIFACTSTAGINGDIRECTORY\\Binaries\\$applicationName\\*.xml&#8220; -recurse<br \/>\nRemove-Item &#8222;$env:BUILD_ARTIFACTSTAGINGDIRECTORY\\Binaries\\$applicationName\\*.snk&#8220; -recurse<br \/>\n}<\/p>\n<p>function CopyMsi($applicationName, $MsiFile, $relativeMsiPath, $relativeBinarySourcePath)<br \/>\n{<br \/>\nwrite-output &#8222;Application Name: $applicationName&#8220;<br \/>\nwrite-output &#8222;Relative Path to Msi: $relativeMsiPath&#8220;<br \/>\nwrite-output &#8222;Msi File: $MsiFile&#8220;<br \/>\nwrite-output &#8222;Relative Path To BinarySources: $relativeBinarySourcePath&#8220;<\/p>\n<p>write-output &#8222;Rename $applicationName Setup to $applicationName.$env:CUSTOM_VERSION.msi&#8220;<br \/>\nRename-Item &#8222;$env:BUILD_SOURCESDIRECTORY\\$relativeMsiPath\\$MsiFile&#8220; &#8222;$applicationName.$env:CUSTOM_VERSION.msi&#8220;<\/p>\n<p>write-output &#8222;Copy $applicationName Setup to $env:BUILD_ARTIFACTSTAGINGDIRECTORY\\&#8220;<br \/>\nCopy-Item &#8222;$env:BUILD_SOURCESDIRECTORY\\$relativeMsiPath\\*.msi&#8220; $env:BUILD_ARTIFACTSTAGINGDIRECTORY<\/p>\n<p>if(![string]::IsNullOrEmpty($relativeBinarySourcePath))<br \/>\n{<br \/>\nCopyBinaries $applicationName $relativeBinarySourcePath<br \/>\n}<br \/>\n}<\/p>\n<p>function CopyWebDeployPackage($applicationName, $originWebDeployPackage, $relativeBinarySourcePath)<br \/>\n{<br \/>\n$webDeployFolder=&#8220;WebDeployment&#8220;<\/p>\n<p>write-output &#8222;Application Name: $applicationName&#8220;<br \/>\nwrite-output &#8222;WebDeploy Folder: $webDeployFolder&#8220;<br \/>\nwrite-output &#8222;Origin WebDeployPackage: $originWebDeployPackage&#8220;<br \/>\nwrite-output &#8222;Relative Path To BinarySources: $relativeBinarySourcePath&#8220;<\/p>\n<p>write-output &#8222;Rename $originWebDeployPackage WebDeploy Package to $applicationName.$env:CUSTOM_VERSION.zip&#8220;<br \/>\nRename-Item &#8222;$env:BUILD_SOURCESDIRECTORY\\$webDeployFolder\\$originWebDeployPackage&#8220; &#8222;$applicationName.$env:CUSTOM_VERSION.zip&#8220;<\/p>\n<p>write-output &#8222;Copy $applicationName WebDeployPackage to $env:BUILD_ARTIFACTSTAGINGDIRECTORY&#8220;<br \/>\nCopy-Item &#8222;$env:BUILD_SOURCESDIRECTORY\\$webDeployFolder\\$applicationName.$env:CUSTOM_VERSION.zip&#8220; $env:BUILD_ARTIFACTSTAGINGDIRECTORY<\/p>\n<p>if(![string]::IsNullOrEmpty($relativeBinarySourcePath))<br \/>\n{<br \/>\nCopyBinaries $applicationName $relativeBinarySourcePath<br \/>\n}<br \/>\n}<\/p>\n<p>CopyWebDeployPackage &#8222;WebDeployPackageName&#8220; &#8222;WebDeployPackageName.zip&#8220; &#8222;ToWebDeployPackageSource\\obj\\Release\\Package\\PackageTmp&#8220;<br \/>\nCopyBinaries &#8222;ApplicationName&#8220; &#8222;ApplicationPathToBinaries\\bin\\Release&#8220;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Script: function CopyBinaries($applicationName, $relativeBinarySourcePath) { write-output &#8222;Create $env:BUILD_ARTIFACTSTAGINGDIRECTORY\\Binaries\\$applicationName&#8220; New-Item -ItemType Directory -Force -Path &#8222;$env:BUILD_ARTIFACTSTAGINGDIRECTORY\\Binaries\\$applicationName&#8220; write-output &#8222;Copy $applicationName Binaries to $env:BUILD_ARTIFACTSTAGINGDIRECTORY\\Binaries\\$applicationName&#8220; Copy-Item &#8222;$env:BUILD_SOURCESDIRECTORY\\$relativeBinarySourcePath\\*&#8220; &#8222;$env:BUILD_ARTIFACTSTAGINGDIRECTORY\\Binaries\\$applicationName&#8220; -recurse Remove-Item &#8222;$env:BUILD_ARTIFACTSTAGINGDIRECTORY\\Binaries\\$applicationName\\*.pdb&#8220; -recurse Remove-Item &#8222;$env:BUILD_ARTIFACTSTAGINGDIRECTORY\\Binaries\\$applicationName\\*.xml&#8220; -recurse Remove-Item &#8222;$env:BUILD_ARTIFACTSTAGINGDIRECTORY\\Binaries\\$applicationName\\*.snk&#8220; -recurse } function CopyMsi($applicationName, $MsiFile, $relativeMsiPath, $relativeBinarySourcePath) { write-output &#8222;Application Name: $applicationName&#8220; write-output &#8222;Relative Path to Msi: $relativeMsiPath&#8220; write-output &#8222;Msi File: $MsiFile&#8220; write-output [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-264","post","type-post","status-publish","format-standard","hentry","category-team-foundation-server"],"_links":{"self":[{"href":"https:\/\/blog.gerst-it.com\/index.php?rest_route=\/wp\/v2\/posts\/264","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.gerst-it.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.gerst-it.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.gerst-it.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.gerst-it.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=264"}],"version-history":[{"count":2,"href":"https:\/\/blog.gerst-it.com\/index.php?rest_route=\/wp\/v2\/posts\/264\/revisions"}],"predecessor-version":[{"id":267,"href":"https:\/\/blog.gerst-it.com\/index.php?rest_route=\/wp\/v2\/posts\/264\/revisions\/267"}],"wp:attachment":[{"href":"https:\/\/blog.gerst-it.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.gerst-it.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.gerst-it.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}