开发者

Where does Context.Track<T> information go?

开发者 https://www.devze.com 2023-02-25 14:29 出处:网络
I have tried public sealed class WriteMessage : CodeActivity { protected override void Execute(CodeActivityContext context)

I have tried

public sealed class WriteMessage : CodeActivity
{
    protected override void Execute(CodeActivityContext context)
    {
        context.Track(new BuildInformationRecord<Foo开发者_运维知识库>()
        {
            Value = FooInstance,
        });
    }
} 

and

then found an overload on context.Track that accepts <T>

context.Track(FooInstance);

and neither one appears in the build viewer in visual studio.

context.TrackBuildMessage(string data) certainly does.

and I'm not getting any exception, is it being saved to the tfs data store, or a file? or is just silently failing entirely?

Reference to one of the resources implicating how this works or should work from the code side


it actually does make it its way to the datastore. Your instance is converted into a Dictionnary<String,String> by reflection on its properties (you may provide a type converter to Dictionnary<String,String> if you like) then stored as a build record into the database. Records are logically structured as a tree. You may retrieve this info through the TFS API.

You are using a new type for TFS which is "Foo". Thus, your info cannot yet be displayed on the build reports in Visual Studio because VS doesn't know how to represent it. You actually need to extend VS build reports with a custom addin that can convert this into WPF controls for rendering.

If you track a "BuildMessage", this is a well known type by VS, it will be displayed in the build log.

You may as well develop a Warehouse adapter to bring this data from the stored build reports to the TFS warehouse store (and also the TFS cube).

About adding custom info into the build :

  • http://blogs.msdn.com/b/patcarna/archive/2009/11/19/tfs-2010-customizing-build-information-part-2.aspx (and have a look at part 1)

My article on my blog in french (answers exactly your question, sorry, yeah... french) :

  • http://blogs.codes-sources.com/vlabz/archive/2011/09/24/tfs-2010-enrichir-les-donn-es-d-un-build.aspx

Hope this helps. (I can't post more links at the moment since I'm a new user, contact me directly I'll send you nice URLs, or google for "Changing The Way Build Information IS Displayed")

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号