none
Windows.ApplicationModel namespace is not available in a Windows Application project (System.Windows.Forms) RRS feed

  • Question

  • Hi, I am using the Desktop Bridge (Windows Application Packaging Project) to publish my Windows Form application to windows store. I added this in the wap-projects 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>

    Then I was supposed to use this line:

    var startupTask = await Windows.ApplicationModel.StartupTask.GetAsync("HelloCentennialTask");

    But the namespace Windows.ApplicationModel is not available in this project type. It seem to be available only in a "Universal Windows" project. 

    Tuesday, May 21, 2019 12:35 PM

Answers

  • Hi Jon76,

    >But the namespace Windows.ApplicationModel is not available in this project type. It seem to be available only in a "Universal Windows" project. 

    Did you add the System.Runtime.WindowsRuntime.dll and Windows.winmd for your Windows Forms application's References? In my test project, when I added them, the Windows.ApplicationModel could be available.

    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:13 PM
    Wednesday, May 22, 2019 5:55 AM
    Moderator