###前提・実現したいこと
ここに質問したいことを詳細に書いてください
C#(XAML)でCortanaと連携するヘルプシステムを作っています。
ビルドしてexeを叩いても、以下のエラーメッセージが発生し動きません。
このアプリケーションはアップコンテナーのコンテキストで実行される必要があります。
###該当のソースコード
ここにご自身が実行したソースコードを書いてください
XML
<?xml version="1.0" encoding="utf-8" ?> <VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.2"> <CommandSet xml:lang="ja-jp" Name="HolCommandSet_ja-jp"> <CommandPrefix>サンプルアプリ</CommandPrefix> <Example>起動</Example></CommandSet> </VoiceCommands><Command Name="LaunchApp"> <Example>起動</Example> <ListenFor>起動</ListenFor> <Feedback>サンプルアプリを起動しています</Feedback> <Navigate /> </Command>
xaml
<Application
x:Class="App1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
RequestedTheme="Light">
C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.VoiceCommands;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace App1
{
/// <summary>
/// 既定の Application クラスを補完するアプリケーション固有の動作を提供します。
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// 単一アプリケーション オブジェクトを初期化します。これは、実行される作成したコードの
///最初の行であるため、main() または WinMain() と論理的に等価です。
/// </summary>
//public App()
//{
// this.InitializeComponent();
// Suspending += OnSuspending;
//}
//private void OnSuspending(object sender, SuspendingEventArgs e) //{ // throw new NotImplementedException(); //} /// <summary> /// アプリケーションがエンド ユーザーによって正常に起動されたときに呼び出されます。他のエントリ ポイントは、 /// アプリケーションが特定のファイルを開くために起動されたときなどに使用されます。 /// </summary> /// <param name="e">起動の要求とプロセスの詳細を表示します。</param> protected override async void OnLaunched(LaunchActivatedEventArgs arg) { var storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///VoiceCommands.xml")); await VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(storageFile); } protected override void OnActivated(IActivatedEventArgs args) { //System.Console.Writeline("Hello World"); //TextBox(e); } }
}
###試したこと
管理者で実行
コマンドプロンプトで実行
ファイル名で実行
###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
Windows10 1607
Visual Studio Community 2015
.Net FW 4.5x
Cortana 正常に動く
回答1件
あなたの回答
tips
プレビュー