I'm trying to get my Centennial application to autostart on logon. According to this post that can be done. But then to disable it programmatically I'd need to use the Windows.ApplicationModel.StartupTask class and Visual Studio refuses to recognize it. So how is that class used?
Asked
Active
Viewed 217 times
1 Answers
1
Stefan Wick MSFT
- 13,600
- 1
- 32
- 51
-
Thanks. Now at next hurdle: [This application can only run in the context of an app container.](https://stackoverflow.com/questions/45860740/error-this-application-can-only-run-in-the-context-of-an-app-container). – ispiro Aug 24 '17 at 11:44
-
Do you want to start a new question for this? Please include the StartupTask extension snippet from the appxmanifest and whether or not you are using .NET for your task. – Stefan Wick MSFT Aug 24 '17 at 14:24
-
My previous comment includes a link. It's my new question. And I now added the snippet there. – ispiro Aug 24 '17 at 14:49
-
Got it, added a comment to your new question with a suggestion that I believe will fix it. Please give it a try. – Stefan Wick MSFT Aug 24 '17 at 17:37
-
This does, indeed, allow using the `StartupTask` class. however, that's only in the UWP part of the app. How would I use it in the .net part of the app, since that reference is not available for it? (I'm converting the app using Visual Studio as mentioned [here](https://learn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-packaging-dot-net).) – ispiro Aug 24 '17 at 21:43
-
In your .NET project, add a reference to the .winmd file to get access to the API: Windows Kits\10\References\10.0.15063.0\Windows.ApplicationModel.StartupTaskContract\1.0.0.0 – Stefan Wick MSFT Aug 24 '17 at 22:44
