Our Blog


Historically, we had kept our Nuget packages in Team Foundation Server (version control).  Due to the recent consistency and stability of Nuget I am starting to move towards excluding Nuget packages from TFS Source control.  They just are not required anymore and Visual Studio can very quickly restore from the internet packages locally on your workstation/build server very quickly now.

So, how do we setup both Visual Studio and TFS to stop putting packages in TFS?  Donovan Brown published a post describing the steps.

a) At the solution level (at same location where your sln file is located) create a folder named .nuget (do this from within Source Control Explorer)

b) Create a file named nuget.config and put this within the .nuget folder.  This file should have the following content.

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

c) Create a file .tfignore and put at the solution level also.  Within this text file put a single word packages

So at this point, you have a directory .nuget with the nuget.config file within it, and also a text file .tfignore at the solution level.  Remove any packages that have been put in source control previously and check in.

At this point, close Visual Studio and restart.

Build the solution locally and all should be good, do a check in and if everything is good the packages folder is not checked in. Tada…Essentially, we are putting things in place to tell Visual Studio not to check in packages AND we are telling TFS not to check in the packages folder.  Both the config file and the .tfignore files are needed.


My solution folder looks like…



Reference: http://donovanbrown.com/post/How-to-keep-packages-folder-out-of-TFVC


The following is the solution that addressed this problem.  While setting up a project for TFS build, I came across issues with the build system not transforming my web.config to different configurations.  i.e. I want my web.config to be transformed with web.config.release upon build/publish.

I found the following solution that worked for me.

Within Visual Studio, unload the web project (in this case I am working with a web application), scroll to the bottom and add the following task.  On the build server you can ensure that the path is valid and it is referencing the most appropriate version.  The UsingTask imports the TransformXml method from Microsoft.Web.Publishing.Tasks.dll

<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.Tasks.dll" />

<Target Name="ApplyTransform" Condition="Exists('Web.$(Configuration).config')">
  <TransformXml Source="web.config" Transform="Web.$(Configuration).config" Destination="Web.config" />

Then within the BeforeBuild Target add

<Target Name="BeforeBuild">
    <Exec Command="attrib -r Web.config" />
    <CallTarget Targets="ApplyTransform" />


Exec removes the read-only attribute from the web.config file and the CallTarget will ApplyTransform target





About Us

Web/Mobile Solutions

Our Contacts

Cincinnati, OH 45069