没有powershell的UWP安装程序 [英] UWP installer without powershell

查看:16
本文介绍了没有powershell的UWP安装程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种更加用户友好的方式来为我的 UWP 应用程序制作安装程序.我不想通过商店分发,我知道您需要设置开发人员设置以启用应用程序的旁加载.

I am looking for a more userfriendly way to make an installer for my UWP Application. I don't want to distribute through the store and I am aware that you need to set the developer setting to enable sideloading of applications.

是否可以在 C# 中模拟 PowerShell 脚本的执行,该脚本将 appx 包部署到系统中?如果是这样,当您想要更新 appx 包而不是新安装时,这是如何工作的?

Is it possible, in C#, to mimic the execution of the PowerShell script which deploys an appx package into the system? And if so, how does this work when you want to update the appx package instead of a new install?

我的用户必须手动执行 powershell 脚本来安装应用程序,这似乎有点奇怪.所以我想创建一个安装程序.

It seems a bit weird for my users to have to execute a powershell script by hand to install an application. So I would like to create an installer instead.

详细说明,我正在寻找一种在 C# 中安装 appx 包的方法.我不想使用任何命令行/外部工具

to elaborate, I am looking for a way in C# to install an appx package. I don't want to use any command line / external tools

谢谢

推荐答案

您可以使用 Windows.Management.Deployment.PackageManager 对象的 AddPackageAsync 方法.这在添加应用包示例中针对 C++ 和 C# 进行了演示在 MSDN 上.

You can install an appx package from code with the Windows.Management.Deployment.PackageManager object's AddPackageAsync method. This is demonstrated for C++ and C# in the Add app package sample on MSDN.

要更新现有包调用 PackageManager.UpdatePackageAsync

To update an existing package call PackageManager.UpdatePackageAsync

这篇关于没有powershell的UWP安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆