2017-04-07 143 views
1

我有一個應用程序,我已經轉換使用Desktop to UWP Bridge,特別是Desktop App Converter它自動完成。它轉換和安裝很好,但是當我嘗試運行它時,我收到一個錯誤,說明可執行文件需要提升。我可以用Right Click -> Run as Administrator來解決這個問題,但是我想重新打包應用程序並將其作爲默認值,所以不需要額外的步驟。值得注意的是,我可以在沒有管理員權限的情況下以普通安裝方式運行應用程序,它只是需要此功能的轉換後的應用程序。以管理員身份運行使用Windows Desktop Bridge轉換的應用程序?

有沒有辦法在轉換應用程序的AppxManifest.xml文件中包含所需的提升請求?我希望會有像

<Application Id="MyApp" Permissions="Administrator"> 

上有明顯here文檔一樣簡單的東西,但我無法找到相關的權限或標高什麼。

這是由轉換器生成的AppxManifest.xml

<?xml version="1.0" encoding="utf-8"?> 
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap2="http://schemas.microsoft.com/appx/manifest/uap/windows10/2" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"> 
    <Identity Name="MyApp" ProcessorArchitecture="x86" Publisher="CN=Me" Version="5.70.0.0" /> 
    <Properties> 
    <DisplayName>MyApp</DisplayName> 
    <PublisherDisplayName>Me</PublisherDisplayName> 
    <Logo>Assets\AppStoreLogo.png</Logo> 
    </Properties> 
    <Resources> 
    <Resource Language="en-us" /> 
    <Resource uap:Scale="100" /> 
    <Resource uap:Scale="125" /> 
    <Resource uap:Scale="150" /> 
    <Resource uap:Scale="200" /> 
    <Resource uap:Scale="400" /> 
    </Resources> 
    <Dependencies> 
    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" /> 
    </Dependencies> 
    <Capabilities> 
    <rescap:Capability Name="runFullTrust" /> 
    </Capabilities> 
    <Applications> 
    <Application Id="MyApp" Executable="Integrator.exe" EntryPoint="Windows.FullTrustApplication"> 
     <uap:VisualElements DisplayName="MyApp" Description="MyApp" BackgroundColor="transparent" Square150x150Logo="Assets\AppMedTile.png" Square44x44Logo="Assets\AppList.png"> 
     <uap:DefaultTile Wide310x150Logo="Assets\AppWideTile.png" Square310x310Logo="Assets\AppLargeTile.png" Square71x71Logo="Assets\AppSmallTile.png"> 
      <uap:ShowNameOnTiles> 
      <uap:ShowOn Tile="square150x150Logo" /> 
      <uap:ShowOn Tile="wide310x150Logo" /> 
      <uap:ShowOn Tile="square310x310Logo" /> 
      </uap:ShowNameOnTiles> 
     </uap:DefaultTile> 
     </uap:VisualElements> 
     <Extensions> 
     <uap3:Extension Category="windows.fileTypeAssociation"> 
      <uap3:FileTypeAssociation Name="gfe"> 
      <uap:SupportedFileTypes> 
       <uap:FileType>.gfe</uap:FileType> 
      </uap:SupportedFileTypes> 
      </uap3:FileTypeAssociation> 
     </uap3:Extension> 
     <uap3:Extension Category="windows.fileTypeAssociation"> 
      <uap3:FileTypeAssociation Name="gfs"> 
      <uap:SupportedFileTypes> 
       <uap:FileType>.gfs</uap:FileType> 
      </uap:SupportedFileTypes> 
      </uap3:FileTypeAssociation> 
     </uap3:Extension> 
     <uap3:Extension Category="windows.appExecutionAlias" Executable="Integrator.exe" EntryPoint="Windows.FullTrustApplication"> 
      <uap3:AppExecutionAlias> 
      <desktop:ExecutionAlias Alias="Integrator5.exe" /> 
      </uap3:AppExecutionAlias> 
     </uap3:Extension> 
     </Extensions> 
    </Application> 
    </Applications> 
</Package> 

回答

4

今天不支持自動提升應用程序。用戶可以選擇以管理員身份運行您的應用程序。

這一政策的準備指南的桌面橋叫了一聲: https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-prepare (子彈#2)

感謝, 斯特凡威克 - Windows 8開發平臺

+0

感謝。就像我提到的那樣,當安裝/運行正常時,該應用程序無需管理員權限即可運行,只有在使用該橋進行轉換後才需要管理員。發展援助委員會是否有理由改變這一切? – James

+0

您是否已通過代碼進行調試,以查看觸發提升請求的操作是什麼?您可能需要在應用程序中更改代碼。 –

+0

@StefanWickMSFT,我可以在我的應用程序中至少有一個用戶按鈕來重新啓動它嗎? 我一直在做 var startInfo = new ProcessStartInfo(Process.GetCurrentProcess()。MainModule.FileName){Verb =「runas」}; Process.Start(startInfo); 在桌面應用程序中,但與Desktop Bridge打包在一起時,該呼叫失敗。 – LOST

相關問題