I use Visual Studio 2013 and Team Foundation Server 2013. I have these, as well as a build / Agent controller running on my personal computer called "FUSROHDAH".
My goal is to assemble the assembly generated by the Build TFS agent and open it for debugging in Visual Studio, and use it to index the source PDB to access the source code from the TFS source control so that I can go through the code. I have studied several informative articles on PDB and source indexing, including:
Ed Squared article on Server Source and Symbol Server Support in TFS 2010
John Robbins article on PDB files
I also watched an excellent John Robbins movie about WintellectNOW, which discussed the many nuances of setting up a symbol server, source indexing.
However, despite several days of hair extension, I have not yet been able to do this.
I installed TFS for continuous integration. Here are my settings:
In Build Definition-> Build Defaults, I set the Staging Location to "Copy assembly output to the following folder (UNC path, for example \ server \ share)":
\\ fusrohdah \ builds (this is equivalent to c: \ build on my machine)
Assembly Definition-> Process Template Settings:
The path to publishing the characters: \\ fusrohdah \ symbols \ (this matches the c: \ characters on my machine)
I noticed that the default process template in TFS 2013 is different from the articles discussing TFS 2010. Ed Squared's article has the Index Sources option. In TFS 2013, this parameter disappeared, and the text of the instruction says: "Specify the path to the common symbol store. When this value is set, source indexing is part of the assembly." Therefore, I assume that I have indexed the source code on my builds by simply specifying this location.
So, I take a simple HelloWorld console application, and I am doing a number of changes and checks. I observe that assemblies are published in the assemblies folder, as you would expect, with the EXE and PDB files nearby.
So, I want to take the old assembly and debug it in Visual Studio and execute the source code obtained from indexing the TFS source. I open the EXE in Visual Studio and press F11 to launch the console application and begin to enter the code into the Main () procedure. But when this happens, I get the following message:
--------------------------- Microsoft Visual Studio -------------------- ------- Source file: C: \ builds \ 2 \ LocalTestProject \ HelloWorld \ src \ HelloWorld \ HelloWorld \ Program.cs
Module: C: \ builds \ HelloWorld \ HelloWorld_20140722.6 \ HelloWorld.exe
Process: [6016] HelloWorld.exe
The source file is different from when the module was created. Could you use it anyway as a debugger?
This is apparently the essence of my problem. I understand that when Visual Studio reads my PDB file, it must execute TF.exe to get the correct version of the source code from TFS, and it seems to fail. I used PDBStr.exe to view the PDB file published by the assembly and nothing seems to be wrong:
c:\builds\HelloWorld\HelloWorld_20140722.6>pdbstr -r -p:helloworld.pdb -s:srcsrv SRCSRV: ini ------------------------------------------------ VERSION=3 INDEXVERSION=2 VERCTRL=Team Foundation Server DATETIME=Tue Jul 22 23:04:51 2014 INDEXER=TFSTB SRCSRV: variables ------------------------------------------ TFS_EXTRACT_CMD=tf.exe view /version:%var4% /noprompt "$%var3%" /server:%fnvar%( %var2%) /console >%srcsrvtrg% TFS_EXTRACT_TARGET=%targ%\%var2%%fnbksl%(%var3%)\%var4%\%fnfile%(%var5%) SRCSRVVERCTRL=tfs SRCSRVERRDESC=access SRCSRVERRVAR=var2 VSTFSSERVER=http://fusrohdah:8080/tfs/DefaultCollection SRCSRVTRG=%TFS_extract_target% SRCSRVCMD=%TFS_extract_cmd% SRCSRV: source files --------------------------------------- C:\Builds\2\LocalTestProject\HelloWorld\src\HelloWorld\HelloWorld\Program.cs*VST FSSERVER*/LocalTestProject/HelloWorld/HelloWorld/Program.cs*18*Program.cs SRCSRV: end ------------------------------------------------
In the output window, I see that Visual Studio believes that it successfully loaded the characters when I debug my EXE. I do not see the message that he was running the TF.exe file, so I believe that he does not run it to get the source.
I checked in Visual Studio that I have "Include only my code" UNCHECKED and "Enable source server support", as well as "Diagnostic messages from the print source server to the output window".
Question: how do I know if Visual Studio is trying to run the TF.exe file to get the source code from TFS, as I would expect?
Also, I'm not sure if my problem is with assembly configuration, character server / source server configuration, or my approach to trying to debug using the above parts. I promise loyalty to a wizard who can light my path for me!