运行 始终以管理员身份使用 Windows 桌面桥转换的应用程序?
Running an app converted with the Windows Desktop Bridge as admin always?
我有一个使用 Desktop to UWP Bridge, specifically the Desktop App Converter 自动转换的应用程序。它可以很好地转换和安装,但是当我尝试 运行 它时,我收到一个错误,指出可执行文件需要提升。我可以使用 Right Click -> Run as Administrator
解决此问题,但我希望将此应用程序作为默认设置重新打包,因此不需要此额外步骤。值得注意的是,我可以 运行 该应用程序作为正常安装而无需管理员权限,只有转换后的应用程序才需要它。
有没有办法将所需的提升请求包含在与转换应用相关的 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>
更新: 自 Windows 10 更新 1809(内部版本 17763)起,您现在可以声明 'allowElevation' 功能以启用 auto/self-elevation.这是有关此功能的教程:https://stefanwick.com/2018/10/01/app-elevation-samples-part-1/
上一个答案(适用于 Windows 10 的 1809 年前版本):
目前不支持应用程序的自动提升。不过,用户可以选择 运行 您的应用作为管理员。
Desktop Bridge 的准备指南中提到了此策略:
https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-prepare
(项目符号 #2)
谢谢,
Stefan Wick - Windows 开发者平台
我有一个使用 Desktop to UWP Bridge, specifically the Desktop App Converter 自动转换的应用程序。它可以很好地转换和安装,但是当我尝试 运行 它时,我收到一个错误,指出可执行文件需要提升。我可以使用 Right Click -> Run as Administrator
解决此问题,但我希望将此应用程序作为默认设置重新打包,因此不需要此额外步骤。值得注意的是,我可以 运行 该应用程序作为正常安装而无需管理员权限,只有转换后的应用程序才需要它。
有没有办法将所需的提升请求包含在与转换应用相关的 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>
更新: 自 Windows 10 更新 1809(内部版本 17763)起,您现在可以声明 'allowElevation' 功能以启用 auto/self-elevation.这是有关此功能的教程:https://stefanwick.com/2018/10/01/app-elevation-samples-part-1/
上一个答案(适用于 Windows 10 的 1809 年前版本):
目前不支持应用程序的自动提升。不过,用户可以选择 运行 您的应用作为管理员。
Desktop Bridge 的准备指南中提到了此策略: https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-prepare (项目符号 #2)
谢谢, Stefan Wick - Windows 开发者平台