Showing posts with label TFS2013. Show all posts
Showing posts with label TFS2013. Show all posts

Monday, December 29, 2014

TFS2013 Web.Config Transformation in Build

Hi
i have been looking around how to create web.config transformation when using tfs build.
there are 3 options:
  • Use publish profile -         this is done by creating a publish profile (right click on the project and select publish), then add to the build definition, "MSBuild Arguments"
         /p:DeployOnBuild=true /p:PublishProfile=<ProjectLocation>\Properties\PublishProfiles\Test.pubxml
  • Add "xmlTransform" task to the csproj -  open the csproj file for edit (Unload and edit) and add right before the end
<Target Name="TransformConfigFiles" AfterTargets="AfterBuild" Condition="'$(TransformConfigFiles)'=='true'">
    <ItemGroup>
      <DeleteAfterBuild Include="$(WebProjectOutputDir)Web.*.config" />
    </ItemGroup>
    <TransformXml Source="Web.config" Transform="$(ProjectConfigTransformFileName)" Destination="$(WebProjectOutputDir)Web.config" />
    <Delete Files="@(DeleteAfterBuild)" />
</Target>
          in order to control this, you need to add to the build definition, "MSBuild Arguments"
          /p: TransformConfigFiles=true
  • Force MSBuild to run Config transformation - this is done by add to the build definition, "MSBuild Arguments"
          /p:UseWPP_CopyWebApplication=True /p:PipelineDependsOnBuild=False




just don't forge, if you are using TFS2013 with old build templates (2010/2012) you will also need to add "/p:VisualStudioVersion=12.0"

Saturday, November 22, 2014

Import Unit Tests to Test Cases

Using UI Automation and Unit tests in general is a good thing,
but VS does not provide a simple way of associating the tests to test cases.
you have to open a test case and associate the unit test, for one, two it ok,
for more then 10 its very tedious
in VS2010 we had a nice extesion called "Pronto",
in VS 2012 and above this does not work any more.

luckly the TCM command comes very handy here:
tcm testcase /import /collection:http://mytfs:8080/tfs/mycollection /teamproject:"myTeamProject" /storage:"fullpath_to_UT_DLL" [/filter:"test category"] [/syncsuite:"test suite id to update"]

this command will pass over all matching unit tests in the dll and add / update testcases.

MSDN TCM link : http://msdn.microsoft.com/en-us/library/ff942470.aspx

Saturday, July 19, 2014

TFS2013 Build, New Features Overview 1

TFS2013, brought many ALM ,cource control and  web access changes.
one of these changes was the integration of Git as a source control from Team projects.
another small one was adding scripts to the build templates.

TFS2013 brings us 2 new Build Templates
  1. TFVCTemplate.12.Xaml
  2. GitVCTemplate.12.Xaml
i will talk most on the TfvcTemplate.
here the template ,as you can see it's very simple compared to the previous versions (tfs2010 /2012).


here is the exception handling 
 here is the finally clause of the Try. the most important activity here is the "Reset the Environment".
this activity clears all the TF build environment variable which will talk about later.
 the template contains no If statements or parallel. so how does it control the activities?
simple each activity has an Enable switch.
also you might notice that there is no "for-each" like for the MSBuild like previous versions.
this means that a lot of the logic was entered to the MSBuild Activity.
you might also notice that there is no Get Build or Create workspace.
this was done to expose some common variables to the power shell scripts