locked
which is the right template for creating a background task in C++

    Question

  • Hi

    I am creating a Background task for my metro app and I am not sure which remplate I should start with.

    In C# there is a "Class Library" template but not in CPP so is it ok to start with "WinRT component" template.

    Also in the "whitepaper" it was mentioned to change the output type to "winmd" but i could not find a way to do that in a cpp project though i found it was doable in a C# project

    Thursday, June 14, 2012 5:50 PM

Answers

  • Yes, that's appropriate. The WinRT Component project will create a winmd file if you want this background task class to be a component.
    • Proposed as answer by Jesse Jiang Monday, June 18, 2012 11:23 AM
    • Marked as answer by gaurav_kl Monday, June 18, 2012 4:33 PM
    Thursday, June 14, 2012 10:02 PM
    Moderator

All replies

  • Yes, that's appropriate. The WinRT Component project will create a winmd file if you want this background task class to be a component.
    • Proposed as answer by Jesse Jiang Monday, June 18, 2012 11:23 AM
    • Marked as answer by gaurav_kl Monday, June 18, 2012 4:33 PM
    Thursday, June 14, 2012 10:02 PM
    Moderator
  • Thanks for the response.

    I am facing another problem in writing my Background task.

    I have followed all the steps in the whitepaper and also looked at

    the BGTask sample project in C++.

    But the "Run" method of my task is not getting activated.

    I have added the "task" project  in the dependencies and references of the main app.

    I could see by breakpoints that my "Task" is getting registered properly in the main app.

     So what could be the reason?I am using TimeZoneTrigger and this trigger works fine for me in the "sample" project

    Thursday, June 14, 2012 10:08 PM
  • I can't speculate. What are you seeing when you enable debug tracing via the event viewer?
    Friday, June 15, 2012 11:11 PM
    Moderator
  • Monday, June 18, 2012 4:35 PM