Skip to content

Instantly share code, notes, and snippets.

@xavierdecoster
Created January 14, 2013 11:53
Show Gist options
  • Save xavierdecoster/4529586 to your computer and use it in GitHub Desktop.
Save xavierdecoster/4529586 to your computer and use it in GitHub Desktop.
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