How to use NuGet without adding packages to TFS

Standard

In the recent project I was using few nuget packages. And I was using TFS. Committing these packages into TFS was increasing the size of the repository. Later I found a solution using Enable NuGet Package Restore option. You can enable this option by right clicking on the solution file or from Project > Enable NuGet Package Restore option.

Enable NuGet Package Restore option

Enable NuGet Package Restore option

This will show up a confirmation message like this.

Enable NuGet Package Restore Confirmation

Enable NuGet Package Restore Confirmation

Once you accepts it, Visual Studio will add a .nuget folder to the solution, you need to check in the solution to TFS.

.NuGet folder in solution explorer

.NuGet folder in solution explorer

The nuget.config file contains following XML.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <solution>
    <add key="disableSourceControlIntegration" value="true" />
  </solution>
</configuration>

The disableSourceControlIntegration setting instructs version control systems like TFS to not add the NuGet packages folder to the pending check-ins list.

Now you can delete the packages folder and try to build it again, Visual Studio will be downloading packages for you.

Build - Output Window

Build – Output Window

Happy Programming.

Continuous integration using TFS 2012 express edition – Creating Build definition

Standard

This post is about creating build definition. Build definition play a key role in continuous integration. Each build definition contains instructions about which code projects to compile, what action should trigger a build, what builds should be retained, and where build output should be copied.

To create build definition, Select the Builds menu item from the Team Explorer window, it will be like the following image.

Team Explorer - Builds

Team Explorer – Builds

Click on new build definition link button, which will open a new Tab in VS 2012 Express, like this. A new build definition has five tab pages.

  • General – Like previous version of Visual Studio, it contains build definition name and description. Additional to that, it allows to control build queues, like Enabled, Paused, Disabled. The Paused option is a new feature, which allows to queue the build, but build will start only when administrator starts it.

    General Tab - Build definition

    General Tab – Build definition

  • Trigger – This page contains the various check in triggers, which is same as the previous version.
    Trigger Tab - Build definition

    Trigger Tab – Build definition

    Here is the various trigger modes available.

    • Manual – In this mode, checks won’t trigger a build, instead users need to queue new build after check in.
    • Continuous Integration – The build will trigger, when ever there is a check in. Suitable for Continuous Integration builds
    • Rolling Builds – As the name defines, this build will be always running. It will accumulate all the check-ins until the prior build finishes.
    • Gated Check in – In this mode before the check-in is committed, the build must succeed. So, instead of the check-in causing the build, the build is forced to happen first and then the check-in can finish. This is best suitable build mode for projects like Frameworks. In TFS 2012, there is Merge and build up to n submissions option is available, which helps to specify the maximum number of check-ins you want to build together in any given batch. In general, you don’t risk much disruption by using this option. Each check-in is individually committed or rejected.
    • Schedule – This option can be used for Regression / Nightly kind of builds. This will run on specified day on specified timings.

    We are selecting the second option, Continuous Integration.

  • Workspace – This tab is same as old versions, which helps to define the workspace for build.what part of the source control tree that should be downloaded as part of the build.
    Workspace Tab - Build definition

    Workspace Tab – Build definition

    Here I set the $/WebFramework as my workspace root. You always want to make your workspace as small as possible to speed up build time.

  • Build Defaults – In page, we can define the Build controller, and the Drop location(build output location).
    Build Defaults Tab - Build definition

    Build Defaults Tab – Build definition

    Note: It should be a UNC path, otherwise build may not work correctly. As I am doing a single machine setup, I shared a Folder, used that path as the UNC Path.

  • Process – This page contains information on exactly how and what the build will do.
    Process Tab - Build definition

    Process Tab – Build definition

    The build process templates will display which template is used for builds. The template is XAML file, but VS Express 2012 doesn’t support editing these files with the Designer. So for setting up the build definition, I just modified the Items to build. As I am building a class library, the configurations to build kept as AnyCPU|Release. And project to build, pointed to the solution of the Framework solution file. In the Basic category, there is an option to run Automated Tests as part of build activity, where we need to provide the pattern to identify test assemblies, it will be like assembly.Test.dll.

  • Retention Policy – In the page we can configure how many builds need to be retained.

    Retention Policy - Build definition

    Retention Policy – Build definition

We are done. Save the build build definition. Modify any code, check in the code, which will trigger a new build, and which will display a summary like this.

Build Summary

Build Summary

Happy Continuous integration :)

Continuous integration using TFS 2012 express edition – Adding files to version control

Standard

The last post was about creating team project, in that we created a version control folder. This post is about adding files / solution to version control.

Open Visual Studio Express 2012 For Web, Connect to the Team Project.

Team Explorer - Connected to Team Project

Team Explorer – Connected to Team Project

Create project you want to add to source control / Open project. Right click on the solution explorer and Select Add To Source control.

Add solution to Source control

Add solution to Source control

It will display Add Solution to Source control dialog box.

Add solution to Source control - Dialog

Add solution to Source control – Dialog

Click OK to Add the files to source control. After this, Solution explorer will be like the following.(Note the “+” sign)

Solution Explorer

Solution Explorer

Select the Team Explorer pending changes tab, it will show pending changes like this. You can check in from this tab.

Team Explorer - Pending Changes

Team Explorer – Pending Changes

Happy Programming :)

Continuous integration using TFS 2012 express edition – Creating Team Project

Standard

This post is about creating team project in TFS Express 2012. Every team project requires a process template. A process template is a collection of files that together define various process elements of a team project in Team Foundation Server. Team Project required for version control too. You can create new team project by Create new Team Project… link button, in the team explorer window.

Team Explorer window - Connected to TFS Server

Team Explorer window – Connected to TFS Server

It will popup a New Team Project dialog, where we can provide the name and description. Name is required for users to connect to the Project.

Creating new Team Project - Name and Description

Creating new Team Project – Name and Description

In the next screen, you can select the process template.

Creating new Team Project - Select Process Template

Creating new Team Project – Select Process Template

By default TFS Express 2012 supports 3 process templates.(We can add / remote process templates)

  • Microsoft Visual Studio Scrum 2.0 – This template is for teams who follow the Scrum methodology and use Scrum terminology.
  • MSF for Agile Software Development 6.0 – This template is flexible and will work great for most teams using Agile planning methods, including those practicing Scrum.
  • MSF for CMMI Process Improvement 6.0 – This template is for more formal projects requiring a framework for process improvement and an auditable record of decisions.

Microsoft Visual Studio Scrum 2.0 is the default one, I am using this. Next screen is for specifing source control settings, where you can specify the source control folder, by default it will be team project, otherwise you can create a branch from an existing project. I am creating new folder.

Creating new Team Project - Source control settings

Creating new Team Project – Source control settings

Next screen is the will display the configuration settings, it is a confirmation screen.

Creating new Team Project - Confirmation

Creating new Team Project – Confirmation

Clicking on Finish will the create the Team Project and display completed screen.

Creating new Team Project - Completed

Creating new Team Project – Completed

After that your team explorer will connect to the newly created team project, and will display like this.

Team Explorer window - Connected to team project

Team Explorer window – Connected to team project

You can access the work items, builds etc from the team explorer window. The work items includes Sprit items like Product backlog, tests, defects, tasks etc.

Team Explorer - Accessing work items, builds

Team Explorer – Accessing work items, builds

Happy Programming :)