Exemplo n.º 1
0
        /// <inheritdoc />
        protected override bool AddSourceProperties(SymbolFile symbolFile)
        {
            var itemInformation = GetItemInformation(symbolFile.SourceFiles.Select(item => new TaskItem(item.File.FullName)).Cast<ITaskItem>());
            foreach (var item in symbolFile.SourceFiles)
            {
                var key = GetItemSpec(item.File.FullName, true).ToLower();
                if (!itemInformation.ContainsKey(key))
                {
                    var allKeys = new StringBuilder();
                    foreach (var entry in itemInformation)
                    {
                        allKeys.Append(entry.Key + "|");
                    }

                    throw new KeyNotFoundException(string.Format("Could not find a local information entry for |{0}|.\n{1}.", key, allKeys));
                }

                item.Properties["FileName"] = item.File.Name;
                item.Properties["Revision"] = itemInformation[key].Changeset;
                item.Properties["ItemPath"] = itemInformation[key].ServerPath.TrimStart('$');
                item.IsResolved = true;
            }

            return true;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds the source properties to the symbol file.
        /// </summary>
        /// <param name="symbolFile">The symbol file to add the source properties to.</param>
        /// <returns>
        ///     <c>true</c> if successful; otherwise <c>false</c>.
        /// </returns>
        protected override bool AddSourceProperties(SymbolFile symbolFile)
        {
            IList <SourceFile> sourceFiles = symbolFile.SourceFiles;

            string output;

            if (!GetSourceInfomation(sourceFiles, out output))
            {
                return(false);
            }

            Info info;

            if (!ConvertOutput(output, out info))
            {
                return(false);
            }

            foreach (var sourceFile in sourceFiles)
            {
                if (!info.Entries.Contains(sourceFile.File.FullName))
                {
                    Log.LogWarning("Information for source file '{0}' was not found.", sourceFile.File.FullName);
                    continue;
                }

                var entry = info.Entries[sourceFile.File.FullName];
                AddProperties(sourceFile, entry);
            }

            return(true);
        }
Exemplo n.º 3
0
        /// <inheritdoc />
        protected override bool AddSourceProperties(SymbolFile symbolFile)
        {
            var itemInformation = GetItemInformation(symbolFile.SourceFiles.Select(item => new TaskItem(item.File.FullName)).Cast <ITaskItem>());

            foreach (var item in symbolFile.SourceFiles)
            {
                var key = GetItemSpec(item.File.FullName, true).ToLower();
                if (!itemInformation.ContainsKey(key))
                {
                    var allKeys = new StringBuilder();
                    foreach (var entry in itemInformation)
                    {
                        allKeys.Append(entry.Key + "|");
                    }

                    throw new KeyNotFoundException(string.Format("Could not find a local information entry for |{0}|.\n{1}.", key, allKeys));
                }

                item.Properties["FileName"] = item.File.Name;
                item.Properties["Revision"] = itemInformation[key].Changeset;
                item.Properties["ItemPath"] = itemInformation[key].ServerPath.TrimStart('$');
                item.IsResolved             = true;
            }

            return(true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Adds the source properties to the symbol file.
        /// </summary>
        /// <param name="symbolFile">The symbol file to add the source properties to.</param>
        /// <returns>
        /// 	<c>true</c> if successful; otherwise <c>false</c>.
        /// </returns>
        protected override bool AddSourceProperties(SymbolFile symbolFile)
        {
            IList<SourceFile> sourceFiles = symbolFile.SourceFiles;

            string output;
            if (!GetSourceInfomation(sourceFiles, out output))
                return false;

            Info info;
            if (!ConvertOutput(output, out info))
                return false;

            foreach (var sourceFile in sourceFiles)
            {
                if (!info.Entries.Contains(sourceFile.File.FullName))
                {
                    Log.LogWarning("Information for source file '{0}' was not found.", sourceFile.File.FullName);
                    continue;
                }

                var entry = info.Entries[sourceFile.File.FullName];
                AddProperties(sourceFile, entry);
            }

            return true;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Indexes the symbol file.
        /// </summary>
        /// <param name="item">The symbol file task item.</param>
        /// <returns><c>true</c> if index successfully; otherwise <c>false</c>.</returns>
        protected bool IndexSymbolFile(ITaskItem item)
        {
            bool result = false;

            // step 1: check if source already indexed
            // step 2: get source file list from pdb
            SymbolFile symbolFile = CreateSymbolFile(item);

            if (symbolFile == null)
            {
                return(false);
            }

            // step 3: lookup svn info for each file
            result = AddSourceProperties(symbolFile);
            if (!result)
            {
                return(false);
            }

            string indexFile = Path.GetTempFileName();

            try
            {
                // step 4: create SRCSRV file
                result = CreateSourceIndexFile(symbolFile, indexFile);
                if (!result)
                {
                    return(false);
                }

                // step 5: write SRCSRV to pdb stream
                result = WriteSourceIndex(symbolFile, indexFile);

                if (result)
                {
                    Log.LogMessage("  '{0}' source indexed successfully.", symbolFile.File.Name);
                    Successful++;
                }

                return(result);
            }
            finally
            {
                if (!KeepTempFileForDebugging)
                {
                    File.Delete(indexFile);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Creates an instance of <see cref="SymbolFile"/> from the symbol file task item and add the source file list to it.
        /// </summary>
        /// <param name="item">The symbol file task item.</param>
        /// <returns>An instance of <see cref="SymbolFile"/> or <c>null</c> if there was an error.</returns>
        protected virtual SymbolFile CreateSymbolFile(ITaskItem item)
        {
            SymbolFile symbolFile = new SymbolFile(item.ItemSpec);

            var srcTool = new SrcTool();

            CopyBuildEngine(srcTool);

            if (!string.IsNullOrEmpty(SourceServerSdkPath))
            {
                srcTool.ToolPath = SourceServerSdkPath;
            }

            srcTool.PdbFile = item;

            // step 1: check if source already indexed
            srcTool.CountOnly = true;
            srcTool.Execute();
            if (srcTool.SourceCount > 0)
            {
                Log.LogWarning("'{0}' already has source indexing information.", symbolFile.File.Name);
                Skipped++;
                return(null);
            }
            srcTool.CountOnly = false; // turn off

            // step 2: get source file list from pdb
            srcTool.SourceOnly = true;
            if (!srcTool.Execute())
            {
                Log.LogError("Error getting source files from '{0}'.", symbolFile.File.Name);
                Failed++;
                return(null);
            }

            foreach (string file in srcTool.SourceFiles)
            {
                // check that we didn't get garbage back from SrcTool.
                if (!PathUtil.IsPathValid(file))
                {
                    Log.LogMessage(MessageImportance.Low, "  Invalid path for source file '{0}'.", file);
                    continue;
                }

                SourceFile sourceFile = new SourceFile(file);
                symbolFile.SourceFiles.Add(sourceFile);
            }

            return(symbolFile);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Creates the source index file.
        /// </summary>
        /// <param name="symbolFile">The symbol file to create the index file from.</param>
        /// <param name="sourceIndexFile">The source index file.</param>
        /// <returns>
        ///     <c>true</c> if successful; otherwise <c>false</c>.
        /// </returns>
        protected override bool CreateSourceIndexFile(SymbolFile symbolFile, string sourceIndexFile)
        {
            using (var writer = File.CreateText(sourceIndexFile))
            {
                writer.WriteLine("SRCSRV: ini ------------------------------------------------");
                writer.WriteLine("VERSION=1");
                writer.WriteLine("INDEXVERSION=2");
                writer.WriteLine("VERCTRL=Subversion");
                writer.WriteLine("DATETIME={0}", DateTime.UtcNow.ToString("u"));
                writer.WriteLine("SRCSRV: variables ------------------------------------------");

                // clean name
                string name = string.IsNullOrEmpty(SourceServerName) ? "Name" : SourceServerName.Trim();
                name = Regex.Replace(name, "\\W", "");

                string target = string.IsNullOrEmpty(SourceTargetFormat)
                    ? string.Format("%targ%\\{0}\\%fnbksl%(%var3%)\\%var4%\\%fnfile%(%var1%)", name)
                    : SourceTargetFormat;

                name = name.ToUpperInvariant();

                writer.WriteLine("SVN_{0}_AUTH=", name);
                writer.WriteLine("SVN_{0}_TRG={1}", name, target);
                writer.WriteLine("SVN_{0}_CMD={1} %SVN_{0}_AUTH%", name, SourceCommandFormat);

                writer.WriteLine("SRCSRVTRG=%SVN_{0}_TRG%", name);
                writer.WriteLine("SRCSRVCMD=%SVN_{0}_CMD%", name);

                writer.WriteLine("SRCSRV: source files ---------------------------------------");

                foreach (var file in symbolFile.SourceFiles)
                {
                    if (file.IsResolved)
                    {
                        writer.WriteLine(file.ToSourceString("{File}*{Root}*{ItemPath}*{Revision}"));
                    }
                }

                writer.WriteLine("SRCSRV: end ------------------------------------------------");

                writer.Flush();
                writer.Close();
            }

            return(true);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Writes the source index file to the symbol file.
        /// </summary>
        /// <param name="symbolFile">The symbol file.</param>
        /// <param name="sourceIndexFile">The source index file.</param>
        /// <returns><c>true</c> if successful; otherwise <c>false</c>.</returns>
        protected virtual bool WriteSourceIndex(SymbolFile symbolFile, string sourceIndexFile)
        {
            if (!File.Exists(sourceIndexFile))
            {
                return(false);
            }

            var pdbStr = new PdbStr();

            CopyBuildEngine(pdbStr);
            if (!string.IsNullOrEmpty(SourceServerSdkPath))
            {
                pdbStr.ToolPath = SourceServerSdkPath;
            }

            pdbStr.Command    = "write";
            pdbStr.PdbFile    = new TaskItem(symbolFile.File.FullName);
            pdbStr.StreamFile = new TaskItem(sourceIndexFile);
            pdbStr.StreamName = "srcsrv";

            return(pdbStr.Execute());
        }
Exemplo n.º 9
0
        /// <inheritdoc />
        protected override bool CreateSourceIndexFile(SymbolFile symbolFile, string sourceIndexFile)
        {
            using (var writer = File.CreateText(sourceIndexFile))
            {
                writer.WriteLine("SRCSRV: ini ------------------------------------------------");
                writer.WriteLine("VERSION=3");
                writer.WriteLine("INDEXVERSION=2");
                writer.WriteLine("VERCTRL=Team Foundation Server");
                writer.WriteLine("DATETIME={0}", DateTime.UtcNow.ToString("ddd MMM dd HH:mm:ss yyyy")); // strange format used by TFS, just copied in case its used
                writer.WriteLine("INDEXER=MSCT");                                                       // MSBUILD Community tasks
                writer.WriteLine("SRCSRV: variables ------------------------------------------");
                writer.WriteLine(@"TFS_EXTRACT_CMD=tf.exe view /version:%var4% /noprompt ""$%var3%"" /server:%fnvar%(%var2%) /console >%srcsrvtrg%");
                writer.WriteLine(@"TFS_EXTRACT_TARGET=%targ%\%var2%%fnbksl%(%var3%)\%var4%\%fnfile%(%var5%)");
                writer.WriteLine("SRCSRVVERCTRL=tfs");
                writer.WriteLine("SRCSRVERRDESC=access");
                writer.WriteLine("SRCSRVERRVAR=var2");
                writer.WriteLine(string.Format("VSTFSSERVER={0}", this.TeamProjectCollectionUri));
                writer.WriteLine("SRCSRVTRG=%TFS_extract_target%");
                writer.WriteLine("SRCSRVCMD=%TFS_extract_cmd%");
                writer.WriteLine("SRCSRV: source files ---------------------------------------");

                foreach (var file in symbolFile.SourceFiles)
                {
                    if (file.IsResolved)
                    {
                        writer.WriteLine(file.ToSourceString("{File}*VSTFSSERVER*{ItemPath}*{Revision}*{FileName}"));
                    }
                }

                writer.WriteLine("SRCSRV: end ------------------------------------------------");

                writer.Flush();
                writer.Close();
            }

            return(true);
        }
Exemplo n.º 10
0
 /// <summary>
 /// Creates the source index file.
 /// </summary>
 /// <param name="symbolFile">The symbol file to create the index file from.</param>
 /// <param name="sourceIndexFile">The source index file.</param>
 /// <returns><c>true</c> if successful; otherwise <c>false</c>.</returns>
 protected abstract bool CreateSourceIndexFile(SymbolFile symbolFile, string sourceIndexFile);
Exemplo n.º 11
0
        /// <summary>
        /// Creates the source index file.
        /// </summary>
        /// <param name="symbolFile">The symbol file to create the index file from.</param>
        /// <param name="sourceIndexFile">The source index file.</param>
        /// <returns>
        /// 	<c>true</c> if successful; otherwise <c>false</c>.
        /// </returns>
        protected override bool CreateSourceIndexFile(SymbolFile symbolFile, string sourceIndexFile)
        {
            using (var writer = File.CreateText(sourceIndexFile))
            {
                writer.WriteLine("SRCSRV: ini ------------------------------------------------");
                writer.WriteLine("VERSION=1");
                writer.WriteLine("INDEXVERSION=2");
                writer.WriteLine("VERCTRL=Subversion");
                writer.WriteLine("DATETIME={0}", DateTime.UtcNow.ToString("u"));
                writer.WriteLine("SRCSRV: variables ------------------------------------------");

                // clean name
                string name = string.IsNullOrEmpty(SourceServerName) ? "Name" : SourceServerName.Trim();
                name = Regex.Replace(name, "\\W", "");

                string target = string.IsNullOrEmpty(SourceTargetFormat)
                    ? string.Format("%targ%\\{0}\\%fnbksl%(%var3%)\\%var4%\\%fnfile%(%var1%)", name)
                    : SourceTargetFormat;

                name = name.ToUpperInvariant();

                writer.WriteLine("SVN_{0}_AUTH=", name);
                writer.WriteLine("SVN_{0}_TRG={1}", name, target);
                writer.WriteLine("SVN_{0}_CMD={1} %SVN_{0}_AUTH%", name, SourceCommandFormat);

                writer.WriteLine("SRCSRVTRG=%SVN_{0}_TRG%", name);
                writer.WriteLine("SRCSRVCMD=%SVN_{0}_CMD%", name);

                writer.WriteLine("SRCSRV: source files ---------------------------------------");

                foreach (var file in symbolFile.SourceFiles)
                    if (file.IsResolved)
                        writer.WriteLine(file.ToSourceString("{File}*{Root}*{ItemPath}*{Revision}"));

                writer.WriteLine("SRCSRV: end ------------------------------------------------");

                writer.Flush();
                writer.Close();
            }

            return true;
        }
Exemplo n.º 12
0
        /// <summary>
        /// Creates an instance of <see cref="SymbolFile"/> from the symbol file task item and add the source file list to it.
        /// </summary>
        /// <param name="item">The symbol file task item.</param>
        /// <returns>An instance of <see cref="SymbolFile"/> or <c>null</c> if there was an error.</returns>
        protected virtual SymbolFile CreateSymbolFile(ITaskItem item)
        {
            SymbolFile symbolFile = new SymbolFile(item.ItemSpec);

            var srcTool = new SrcTool();
            CopyBuildEngine(srcTool);

            if (!string.IsNullOrEmpty(SourceServerSdkPath))
                srcTool.ToolPath = SourceServerSdkPath;

            srcTool.PdbFile = item;

            // step 1: check if source already indexed
            srcTool.CountOnly = true;
            srcTool.Execute();
            if (srcTool.SourceCount > 0)
            {
                Log.LogWarning("'{0}' already has source indexing information.", symbolFile.File.Name);
                Skipped++;
                return null;
            }
            srcTool.CountOnly = false; // turn off

            // step 2: get source file list from pdb
            srcTool.SourceOnly = true;
            if (!srcTool.Execute())
            {
                Log.LogError("Error getting source files from '{0}'.", symbolFile.File.Name);
                Failed++;
                return null;
            }

            foreach (string file in srcTool.SourceFiles)
            {
                // check that we didn't get garbage back from SrcTool.
                if (!PathUtil.IsPathValid(file))
                {
                    Log.LogMessage(MessageImportance.Low, "  Invalid path for source file '{0}'.", file);
                    continue;
                }

                SourceFile sourceFile = new SourceFile(file);
                symbolFile.SourceFiles.Add(sourceFile);
            }

            return symbolFile;
        }
Exemplo n.º 13
0
 /// <summary>
 /// Creates the source index file.
 /// </summary>
 /// <param name="symbolFile">The symbol file to create the index file from.</param>
 /// <param name="sourceIndexFile">The source index file.</param>
 /// <returns><c>true</c> if successful; otherwise <c>false</c>.</returns>
 protected abstract bool CreateSourceIndexFile(SymbolFile symbolFile, string sourceIndexFile);
Exemplo n.º 14
0
 /// <summary>
 /// Adds the source properties to the symbol file.
 /// </summary>
 /// <param name="symbolFile">The symbol file to add the source properties to.</param>
 /// <returns><c>true</c> if successful; otherwise <c>false</c>.</returns>
 protected abstract bool AddSourceProperties(SymbolFile symbolFile);
Exemplo n.º 15
0
        /// <summary>
        /// Writes the source index file to the symbol file.
        /// </summary>
        /// <param name="symbolFile">The symbol file.</param>
        /// <param name="sourceIndexFile">The source index file.</param>
        /// <returns><c>true</c> if successful; otherwise <c>false</c>.</returns>
        protected virtual bool WriteSourceIndex(SymbolFile symbolFile, string sourceIndexFile)
        {
            if (!File.Exists(sourceIndexFile))
                return false;

            var pdbStr = new PdbStr();
            CopyBuildEngine(pdbStr);
            if (!string.IsNullOrEmpty(SourceServerSdkPath))
                pdbStr.ToolPath = SourceServerSdkPath;

            pdbStr.Command = "write";
            pdbStr.PdbFile = new TaskItem(symbolFile.File.FullName);
            pdbStr.StreamFile = new TaskItem(sourceIndexFile);
            pdbStr.StreamName = "srcsrv";

            return pdbStr.Execute();
        }
Exemplo n.º 16
0
        /// <summary>
        /// Creates an instance of <see cref="SymbolFile"/> from the symbol file task item and add the source file list to it.
        /// </summary>
        /// <param name="item">The symbol file task item.</param>
        /// <returns>An instance of <see cref="SymbolFile"/> or <c>null</c> if there was an error.</returns>
        protected virtual SymbolFile CreateSymbolFile(ITaskItem item)
        {
            SymbolFile symbolFile = new SymbolFile(item.ItemSpec);

            var srcTool = new SrcTool();

            CopyBuildEngine(srcTool);

            if (!string.IsNullOrEmpty(SourceServerSdkPath))
            {
                srcTool.ToolPath = SourceServerSdkPath;
            }

            srcTool.PdbFile = item;

            // step 1: check if source already indexed
            this.NoSourceInformationInPdb = false;
            srcTool.CountOnly             = true;
            srcTool.Execute();
            if (srcTool.SourceCount > 0)
            {
                Log.LogWarning("'{0}' already has source indexing information.", symbolFile.File.Name);
                Skipped++;
                return(null);
            }
            srcTool.CountOnly = false; // turn off

            // step 2: get source file list from pdb
            srcTool.SourceOnly = true;
            if (!srcTool.Execute())
            {
                if (srcTool.SourceFiles != null && srcTool.SourceFiles.Length > 0 &&
                    srcTool.SourceFiles[0].StartsWith("No source information in pdb for"))
                {
                    this.NoSourceInformationInPdb = true;
                }

                if (this.FailOnNoSourceInformationFound)
                {
                    Log.LogError("Error getting source files from '{0}'.{1}", symbolFile.File.Name, srcTool.SourceFiles != null && srcTool.SourceFiles.Length > 0 ? srcTool.SourceFiles[0] : string.Empty);
                    Failed++;
                }
                else
                {
                    Log.LogWarning("'{0}' has no source information inside the pdb. Check your pdb settings or perhaps your assembly doesn't have any real lines of code in it?", symbolFile.File.Name, srcTool.SourceFiles != null && srcTool.SourceFiles.Length > 0 ? srcTool.SourceFiles[0] : string.Empty);
                    Skipped++;
                }
                return(null);
            }

            foreach (string file in srcTool.SourceFiles)
            {
                // check that we didn't get garbage back from SrcTool.
                if (!PathUtil.IsPathValid(file))
                {
                    Log.LogMessage(MessageImportance.Low, "  Invalid path for source file '{0}'.", file);
                    continue;
                }

                SourceFile sourceFile = new SourceFile(file);
                symbolFile.SourceFiles.Add(sourceFile);
            }

            return(symbolFile);
        }
Exemplo n.º 17
0
 /// <summary>
 /// Adds the source properties to the symbol file.
 /// </summary>
 /// <param name="symbolFile">The symbol file to add the source properties to.</param>
 /// <returns><c>true</c> if successful; otherwise <c>false</c>.</returns>
 protected abstract bool AddSourceProperties(SymbolFile symbolFile);
Exemplo n.º 18
0
        /// <summary>
        /// Creates an instance of <see cref="SymbolFile"/> from the symbol file task item and add the source file list to it.
        /// </summary>
        /// <param name="item">The symbol file task item.</param>
        /// <returns>An instance of <see cref="SymbolFile"/> or <c>null</c> if there was an error.</returns>
        protected virtual SymbolFile CreateSymbolFile(ITaskItem item)
        {
            SymbolFile symbolFile = new SymbolFile(item.ItemSpec);

            var srcTool = new SrcTool();
            CopyBuildEngine(srcTool);

            if (!string.IsNullOrEmpty(SourceServerSdkPath))
                srcTool.ToolPath = SourceServerSdkPath;

            srcTool.PdbFile = item;

            // step 1: check if source already indexed
            this.NoSourceInformationInPdb = false;
            srcTool.CountOnly = true;
            srcTool.Execute();
            if (srcTool.SourceCount > 0)
            {
                Log.LogWarning("'{0}' already has source indexing information.", symbolFile.File.Name);
                Skipped++;
                return null;
            }
            srcTool.CountOnly = false; // turn off 

            // step 2: get source file list from pdb
            srcTool.SourceOnly = true;
            if (!srcTool.Execute())
            {
                if (srcTool.SourceFiles != null && srcTool.SourceFiles.Length > 0 &&
                    srcTool.SourceFiles[0].StartsWith("No source information in pdb for"))
                {
                    this.NoSourceInformationInPdb = true;
                }

                if (this.FailOnNoSourceInformationFound)
                {
                    Log.LogError("Error getting source files from '{0}'.{1}", symbolFile.File.Name, srcTool.SourceFiles != null && srcTool.SourceFiles.Length > 0 ? srcTool.SourceFiles[0] : string.Empty);                
                    Failed++;
                }
                else
                {
                    Log.LogWarning("'{0}' has no source information inside the pdb. Check your pdb settings or perhaps your assembly doesn't have any real lines of code in it?", symbolFile.File.Name, srcTool.SourceFiles != null && srcTool.SourceFiles.Length > 0 ? srcTool.SourceFiles[0] : string.Empty);                
                    Skipped++;
                }
                return null;
            }

            foreach (string file in srcTool.SourceFiles)
            {
                // check that we didn't get garbage back from SrcTool.  
                if (!PathUtil.IsPathValid(file))
                {
                    Log.LogMessage(MessageImportance.Low, "  Invalid path for source file '{0}'.", file);
                    continue;
                }

                SourceFile sourceFile = new SourceFile(file);
                symbolFile.SourceFiles.Add(sourceFile);
            }

            return symbolFile;
        }
Exemplo n.º 19
0
        /// <inheritdoc />
        protected override bool CreateSourceIndexFile(SymbolFile symbolFile, string sourceIndexFile)
        {
            using (var writer = File.CreateText(sourceIndexFile))
            {
                writer.WriteLine("SRCSRV: ini ------------------------------------------------");
                writer.WriteLine("VERSION=3");
                writer.WriteLine("INDEXVERSION=2");
                writer.WriteLine("VERCTRL=Team Foundation Server");
                writer.WriteLine("DATETIME={0}", DateTime.UtcNow.ToString("ddd MMM dd HH:mm:ss yyyy")); // strange format used by TFS, just copied in case its used
                writer.WriteLine("INDEXER=MSCT"); // MSBUILD Community tasks
                writer.WriteLine("SRCSRV: variables ------------------------------------------");
                writer.WriteLine(@"TFS_EXTRACT_CMD=tf.exe view /version:%var4% /noprompt ""$%var3%"" /server:%fnvar%(%var2%) /console >%srcsrvtrg%");
                writer.WriteLine(@"TFS_EXTRACT_TARGET=%targ%\%var2%%fnbksl%(%var3%)\%var4%\%fnfile%(%var5%)");
                writer.WriteLine("SRCSRVVERCTRL=tfs");
                writer.WriteLine("SRCSRVERRDESC=access");
                writer.WriteLine("SRCSRVERRVAR=var2");
                writer.WriteLine(string.Format("VSTFSSERVER={0}", this.TeamProjectCollectionUri));
                writer.WriteLine("SRCSRVTRG=%TFS_extract_target%");
                writer.WriteLine("SRCSRVCMD=%TFS_extract_cmd%");
                writer.WriteLine("SRCSRV: source files ---------------------------------------");

                foreach (var file in symbolFile.SourceFiles)
                    if (file.IsResolved)
                        writer.WriteLine(file.ToSourceString("{File}*VSTFSSERVER*{ItemPath}*{Revision}*{FileName}"));

                writer.WriteLine("SRCSRV: end ------------------------------------------------");

                writer.Flush();
                writer.Close();
            }

            return true;
        }