0

What I have is: VS 2017 Community, C#, Raspberry 3, IoT-Extension referenced. I want to shutdown the Raspberry from code. What I have found on the web everywhere is this: Edit the AppManifest. Add ...IgnorableNamespaces="uap mp iot"> (- which already was there when I looked into it) Then add:

<iot:Capability Name="systemManagement"/>

But: "iot:Capability" stays undercurled, saying, that it "has invalid child element 'Capabilities' in namespace 'http:... appX/manifest/iot/win10'

I had already 2 other capabilites selected

<Capability Name="internetClient" />
<Capability Name="privateNetworkClientServer" />

Can they interfere? I could not find this error somewhere else on the whole web. Would be great if someone had an explanation for this. Thanks in advance!

rlinner
  • 51
  • 5
  • Do you add `xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10"` before `IgnorableNamespaces="uap mp iot"`? – Rita Han Mar 19 '18 at 03:10
  • Yes, it is all complete... – rlinner Mar 19 '18 at 22:42
  • Are your sure it is an error? It is a warning for me and I test on Raspberry Pi 3, I can shut down the device from my app. It works. – Rita Han Mar 20 '18 at 03:31
  • The blue curly line remains under "iot:Capability" and in the .cs code it says the "ShutdownManager does not exist.." – rlinner Mar 21 '18 at 20:43
  • 1
    Add this name space: `using Windows.System;` – Rita Han Mar 22 '18 at 08:50
  • Incredible, that's it! Thank you so much for sticking to my question! I never would have found it (Windows.System seems so basic and already there...). Do you think I can leave the app with this "warning"? If you want to post it as answer I would upvote of course. Thanks again! – rlinner Mar 22 '18 at 09:25
  • I am glad to help you. Yes, you can leave the warning there. – Rita Han Mar 23 '18 at 03:08

1 Answers1

1

To use ShutdownManager to manages the shutdown of devices, you need:

  1. Reference Windows IoT Extension SDK (v10.0.10240.0 or later)
  2. Add the following to application Package.appmanifest: <iot:Capability Name="systemManagement"/>
  3. Add this name space: using Windows.System;

For more detailed information, see ShutdownManager Class.

Rita Han
  • 9,574
  • 1
  • 11
  • 24