Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
My way of dealing with TFS Binaries folder... Simply call the following MSBuild task anywhere you want it to be executed :) <DisplayBinariesFolder RootFolder="C:\a\bin"/>
<UsingTask TaskName="DisplayBinariesFolder" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<RootFolder ParameterType="System.String" Required="true"/>
</ParameterGroup>
<Task>
<Reference Include="System.Core"/>
<Using Namespace="System"/>
<Using Namespace="System.IO"/>
<Using Namespace="Microsoft.Build.Framework"/>
<Using Namespace="Microsoft.Build.Utilities"/>
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
string root = Path.GetFullPath(RootFolder);
if (!Directory.Exists(root))
{
Log.LogMessage("Directory " + root + " does not exist!");
return false;
}
Log.LogMessage("Scanning directory " + root);
DirectoryInfo rootDirectory = new DirectoryInfo(root);
foreach (FileInfo file in rootDirectory.GetFiles("*.*", SearchOption.AllDirectories))
{
Log.LogMessage(file.FullName);
}
return true;
}
catch (Exception ex){
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment