none
Package.appxmanifest not working with proposed change RRS feed

Answers

  • Hi Jon76,

    Could you import the System.Runtime.WindowsRuntime.dll and Windows.winmd in your References to try again? In my device, their path are: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll. and C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd

    Best regards

    Daisy  Tian


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Jon 76 Wednesday, May 22, 2019 2:10 PM
    Wednesday, May 22, 2019 5:49 AM
    Moderator

All replies

  • Hi Jon,

    If you use "Windows Application Packaging Project" to package your Windows Forms application, could you try to add UWP app startup task extension in your Package.appxmanifest ? 

    I test the sample as follow:

    1.create a WinForm project named: TestStartUpWinForm, In the Form1, add a button

    private async void requestButton_Click(object sender, EventArgs e)
            {
                var startupTask = await Windows.ApplicationModel.StartupTask.GetAsync("HelloCentennialTask");
                if (startupTask.State == Windows.ApplicationModel.StartupTaskState.Enabled)
                {
                    startupTask.Disable();
                    MessageBox.Show("The task has been disabled");
                }
                else
                {
                    var state = await startupTask.RequestEnableAsync();
                    switch (state)
                    {
                        case Windows.ApplicationModel.StartupTaskState.DisabledByUser:
                            MessageBox.Show("The task has been disabled by the user");
                            break;
                        case Windows.ApplicationModel.StartupTaskState.Enabled:
                            MessageBox.Show("The task has been enabled");
                            break;
                    }
                }
            }

    2.Create a "Windows Application Packaging Project", named TestStartUWPpackage;

    3.Associate TestStartUWPpackage with the Store

    4.Add following code in TestStartUWPpackage/Package.appxmanifest

    <Package xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" ...>
    ...
    <Applications>
        <Application ...>
            ...
            <Extensions>
              <uap5:Extension Category="windows.startupTask">
                <uap5:StartupTask
                  TaskId="HelloCentennialTask"
                  Enabled="true"
                  DisplayName="Test startup" />
              </uap5:Extension>
          </Extensions>
        </Application>
    </Applications>

    5.Create the Package and install the app

    If I misunderstand your issue, please point out.

    Best regards

    Daisy  Tian


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 21, 2019 7:21 AM
    Moderator
  • The Windows.ApplicationModel namespace is not available for me?!

    Tuesday, May 21, 2019 12:00 PM
  • Hi Jon76,

    Could you import the System.Runtime.WindowsRuntime.dll and Windows.winmd in your References to try again? In my device, their path are: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll. and C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd

    Best regards

    Daisy  Tian


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Jon 76 Wednesday, May 22, 2019 2:10 PM
    Wednesday, May 22, 2019 5:49 AM
    Moderator
  • Great, that works! I wish I had found the docs explaining this a few days ago.. :-) 
    Wednesday, May 22, 2019 2:10 PM