TFS Custom Check-in Policy Debugging - tfs

I have created a custom check-in policy as given in the link below:
http://msdn.microsoft.com/en-us/library/bb668980.aspx
I followed the steps as explained by the article. Everything works fine. My doubt is - Is it possible for me to debug the code while check-in the code?
Consider I want to know what are the methods are called inside the CheckForCommentsPolicy class as stated in article or I have added some business logic which needs to debugged. Which process do I have to attach? or Do I have to follow any other approach for debugging?
Is it possible to debug? Kindly help me out.
Thanks in advance

While MrHinsh's method will in fact work I found that there is an even easier way to debug and would like to recommend that.
If you go to the properties of your checkin policy class project and look under the debug tab you will find a section for Start Action. Select to "Start external program" and browse to where you have visual studio installed.
for instance
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
With this in place and the proper registry keys for loading the policy DLL from your debug folder all you need to do is hit Run and a second copy of VS 2010 will load up and you can debug your class without doing the Debug | Attach to process steps.

Yes. You need to have two copies of Visual Studio open. One had your solution open and the other for running the code.
You need to select "Debug | Attach to Process..."
Figure: Open the Attach to process dialog
You can then see all the available process on your computer and you should see the other instace of Visual Studio (this is the one you will use to run your checkin policy).
Figure: Attach to the devenv.exe process
This will allow you to debug the instance of your Check-in Policy running in the copy of Visual Studio you just Attached to.

I got the answer:
http://msdn.microsoft.com/en-us/magazine/cc163320.aspx#S3

Related

How to check out file in Visual studio code with TFVC?

I have TFS 2017 server which I integrated with my Visual studio code using visual studio team services plugin. I am able to login however when I edit any file and try to save, vs gives me error prompt.
Failed to save 'app.component.html': File is write protected. Select 'Overwrite' to attempt to remove protection.
How do I configure my VS code so that I can check out automatically like vs 2017 ?
Please try below things to narrow down the issue:
Try running the VS code as administrator to check if that works.
You have lost the connection to the Team Foundation Server:
In this case you can try to sign out then sign in again to reconnect.
Alternately you can try removing the current workspace then create a
new one and reconnect to TFS again using the new workspace. Reference
this thread:
Why are all files write protected and how can I check-in?
The problem may be caused by some extensions installed for the VS
code.
In this case you can try resetting User/Project settings to their
defaults and disabling vscode extensions to see if this is an issue
with vscode or a specific extension. If doing this fixes the issue,
try turning on the extensions one at a time and configuring the
User/Project settings to what they were until the culprit is
revealed. Reference nwayve's comment in this thread:https://github.com/Microsoft/vscode/issues/13592
Remove the visual studio team services plugin, then install it again
and reconfigure it, you can reference my answer in another
thread to do that.

Team Foundation Server: How to trigger or run a user script?

I am new to Microsoft TFS, (I am used to Perforce - a similar tool).
How can we trigger or run a user script automatically when ever a particular event occurs
in TFS?
For instance, I want to run my java file when ever a change to any file has been saved through TFS.
(In perforce I used "Change-commit triggers" to achieve this)
Please help me out.
EDIT: After some research,
I figured that we need to "Use the InvokeProcess activity to start a process (run a program) on the build server" from the following source.
But How do I use it?? I am using a "Microsoft Team Explorer for Visual Studio 2012". Not able to figure out how to use InvokeProcess.. Please help me out..
you can't use the default template for invoke process. you need a custom template to set up invoke process.
http://msdn.microsoft.com/en-us/library/ff805001(v=vs.100).aspx ( check the invokeprocess part in this link )
Did you try with Build option available in Team explorer?

In a TFS 2010 build summary, how do I a show a link to the logs from a custom MSBuild task?

In my TFS 2010 build definition, I call MSBuild on my own custom my.targets MSBuild project. It does all the compilation, testing, etc. that I need. Its log file is specified, as is a log drop location, and the log appears properly in that place. However I can't see it in the TFS Build Summary report. The "View Log File" link is grayed out. It seemed to work when the project I was building was a ".sln" file. What magic voodoo is baked deep in to the heart of the common MSBuild files to make this log link work properly, and how can I reproduce it?
You may find your answer in these posts from Jason Prickett:
TFS2010 – Changing The Way Build Information IS Displayed
TFS2010 – Customizing the Build Details View – Summary View
Important to note is that the MSBuild Log File will only appear if you enabled inside the build definition to copy output to the Drop Folder. If that option is disabled, the link will not appear in the build log view.

TFS source control without Visual Studio?

Is it possible to use TFS source control without Visual Studio? I have to put some files in some source control, those files are stored in a folder in some server, that is something developed in Oracle forms. I just need to add those files in some source control and I'd like to use TFS for that. Any tips or tools could we use for this?
TFS is likely to be overkill for a few files in a single folder, but if the TFS infrastructure is already in place then it will work.
You will need Team Explorer (or, on non-Windows) Team Explorer Everywhere installed to give you the client tools. But you can perform all source code operations with the tf.exe command line (or equivalent from Team Explorer Everywhere).
Team Foundation Server Power Tools has Windows Shell Extensions that provides integration
with Windows Explorer and the common file dialogs. With this integration, you can perform many source control operations without having to run Visual Studio or a Team Foundation command-line tool.
see this answer but you will need to make sure you have tfs server running as well to connect to. Would it not be simpler to use git/mercurial/svn...{any other free source control system}?
I am one of the lovers of TFS, but I think in your case if you don't need to use Team Explorer or Team Explorer Everywhere (which will need command line used) for none windows I suggest to use SVN sub version (VisualSVN Server) it's open source and it has integrated OS shell (TortoiseSVN ) right click menu which will be easy than using command line
Vlad: That is true, but this important: I have used the "Shell Extensions" for a while only to realize that it does create problems. First of all, the "Shell Extensions" does not report errors during a check-in; it only unexpectedly stops, and the window closes.
Also, the reason I am looking for an external "Source Control Explorer" is that if you delete any file from Window Explorer that was under Source Control by TFS, the Check-In procedure will fail saying that there is a file missing. The correct way to safely delete a file is to do it through "Source Control Explorer"; the check-in then works. Usually not a problem, unless, like me, you have a Java project and have no integration between NetBeans & TFS.

TFS 2010 Missing Process Templates

I am trying to set up continuous integration using Visual studio 2010 and TFS 2010 and when i try to Create a new build definition, and go to Process Tab, i dont see any templates under the Build Process file(Windows workflow XAML) drop-down.
I have setup a build controller that points to our Team project collection and a build agent, in our TFS server.I am trying to setup a new build definition from my local machine Visual studio and i cant see any default templates under the Build Process file(Windows workflow XAML) drop-down.
Is there any settings i am missing ?Please let me know. Do i also need to install Visual studio in the TFS Server ?
All i need is whenever someone checks in a file, it should kick off a build and see the status if the build is broken or not !
Make sure you have a folder inside your Team Project Source Control called:
BuildProcessTemplates
Inside of there should be the following files:
DefaultTemplate.xaml
UpgradeTemplate.xaml
There are additional ones in this example, but you should have those two from the install.
If you have this folder and still cannot see anything in that dropdown let me know and we can take it from there. What most likely happened is you or someone on your team saw the folder and deleted it or moved it thinking it its placement wasn't important in the project. Or perhaps deleted the xaml files inside there.
The process section uses that folder and all files within it to display on that prompt.

Resources