Ignore all NuGet packages in TFS

I didn’t want to add the NuGet packages of my Visual Studio solution to TFS, because I download all NuGet packages during build.

 

image

 

To exclude all NuGet packages from TFS:

  • Add a folder “.nuget” to the folder that also contains the “packages” folder and in most cases the “solution file”.
    • add a file to the “.nuget” folder with the name “NuGet.config”
      • contents of the file:
      • <?xml version="1.0" encoding="utf-8"?>
        <configuration>
          <solution>
            <add key="disableSourceControlIntegration" value="true" />
          </solution>
        </configuration>

  • Add a file “.tfignore”  to the folder that also contains the “packages” folder and in most cases the “solution file”.
    • contents of the file:
      • \packages

 

More information: http://stackoverflow.com/questions/26604506/tfs-vs-2013-ignore-all-nuget-packages

Undo pending changes from a specific user account

 

If you want to undo some changes from a specific user, you can use:

 

Change directory to folder containing "tf.exe"
    • cd "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE"

Check the status of checked out files, to see correct "account"
    • tf status "$/TFS/Path/To/Folder/To/Search/For/Pending/Changes" /s:123.123.123.123 /u:* /recursive /format:detailed

Undo pending changes
    • tf undo /workspace:"S001";MyDomain\myUserName "$/TFS/Path/To/Folder/To/Search/For/Pending/Changes" /recursive

Building in the cloud and deploying locally with visualstudio.com with Microsoft Visual Studio 2013

If you use the Team Foundation Service (on visualstudio.com) as your source control system, you can build your sources in the cloud, but access the build outputs locally.

Just start a new project on visualstudio.com and add a solution with some projects to it.

In my case a ASP .NET Web Api 2.0 project, a integration test project and a unit test project:

clip_image001

In the source control explorer it look like:

clip_image002

Create a build definition

Create a build definition in Microsoft Visual Studio 2013

If you choose for the option "Copy build output to the following Source Control folder (this folder will be created if it does not exist)".

The output of the build will be put in TFS.

So after the build you can download it from TFS and deploy locally.

Downloading can be automated by using PowerShell or some other tooling.

clip_image003

When you choose to put the output of the builds in TFS, you will find a "Drops" folder in the source control explorer.

clip_image004

clip_image005

The build result summary, shows some statistics on the build:

clip_image006

 

The builds can also be executed online and the result can also be seen online in the browser:

image

Adjusting TFS 2012 Kanban board columns (count and titles) without changing the default process template statuses.

The screencast below explains, how different teams can layout their Kanban board, without changing the default process template statuses "New", "Active", "Resolved", "Closed"

http://channel9.msdn.com/posts/Customize-your-kanban-board-columns-in-Team-Foundation-ServiceServer

 

Example

Team A (less columns, then statuses)

Backlog | Active | Done

 

Team B (more columns, then statuses)

Backlog | UAT | Development | Code Review | Test | Done

 

Because both Kanban boards use the same statuses under the covers, queries and reports can span multiple teams.

How to fix: Can’t drag and drop custom Team Foundation Build Activity on XAML build process template in Microsoft Visual Studio 2010.

A .NET 4.0 assembly containing a custom Team Foundation Build Activity can only be dragged and dropped from the toolbox on your build process template XAML file, when it is first registered in the GAC. For registering a .NET 4.0 assembly in the GAC you will have to use the gacutil.exe for .NET 4.0 found at [C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe].

If you don’t register the assemlby in the GAC you can’t drag and drop the Team Foundation Build Activity on the build process template XAML file. If it was added by an other developer, you get the error: "Activity could not be loaded because of errors in the XAML":

 

image

 

 

After registering the .NET 4. 0 assembly with the gacutil.exe, the assembly can be found at [C:\Windows\Microsoft.NET\assembly\GAC_MSIL].

After registering, make sure you restart Microsoft Visual Studio 2010 before you drag and drop the custom Team Foundation Build Activity on your build process template XAML file.

How to compare two files (not checked in to TFS) on disk with Microsoft Visual Studio

If you want to compare two files on disk that are not checked in to TFS, by using Microsoft Visual Studio, you can use the following steps:

1. Open Microsoft Visual Studio > Team Explorer > Source Control

2. Navigate to a random file en right click it:

image

3. Click on Compare…

4. For the Source Path: Click Browse… > Local Path… and browse to the first file.

image

5. Repeat this for the target path

6. Click OK

 

Now the two files will be compared and the differences will be shown, without the files being checked in to TFS.

Solving: CSC: Assembly generation — Referenced assembly ‘mscorlib.dll’ targets a different processor in MSBUILD

I was getting the warning / error in the MSBUILD output

CSC: Assembly generation — Referenced assembly ‘mscorlib.dll’ targets a different processor in MSBUILD

 

After setting the [MSBuild Platform] to [X86] in the build definition, the warnings / errors were resolved.

 

image

Solving:Locked / checked out files in TFS 2010 on an other workspace

When you use different (virtual) machines to check out files in Microsoft TFS 2010, different workspaces are used. If you forget to check in a file on machine A, you can’t check that specific in on machine B. To solve this problem there are multiple solutions:

1. Start machine A en check the files in.

2. Use the TFS administration application if you have sufficient rights.

or

3. Delete the machine A workspace in the Source Control Explorer on Machine B.

 

image

Delete workspace:

image

After deleting the workspace I could check the files out and in again.

TFS 2010 Best Practices and TFS Structure

We used the TFS Best Practices Guide on CodePlex for deploying and using our TFS server: http://tfsguide.codeplex.com/

 

TeamDevGuide.gif

 

Based on this guide we used the following TFS Structure:

 

$MyTeamProject1

/Main                                                                                    à Can contain solution (.sln) files

/Source

/MyApp1                                              à Contains MyApp1.sln file

/ClassLibrary1                       à Contains ClassLibrary1.csproj

/MyApp1Web                       à Contains Default.aspx

/ClassLibrary1Tests              à Contains test project and code

/MyApp1WebTests              à Contains test project and code

/MyApp2                                              à Contains MyApp2.sln file

/ClassLibrary2                      à Contains ClassLibrary1.csproj

/MyApp2Web                       à Contains Default.aspx

/ClassLibrary2Tests              à Contains test project and code

/MyApp2WebTests              à Contains test project and code

/SharedBinaries                                     à Shared binaries e.g. libraries

/SharedSource                                       à Shared source code

/Docs                                                                    à Contains product documentation

/Tests                                                                    à Container for tests

/FunctionalTests

/PerformanceTests

/SecurityTests

/TeamBuildTypes                                                                  à Created automatically by Team Build.

/BuildType1

/BuildType2