如何访问 Windows.Management.Deployment 命名空间? [英] How to access the Windows.Management.Deployment namespace?

查看:42
本文介绍了如何访问 Windows.Management.Deployment 命名空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个集成测试套件,我正在尝试扩展它以允许测试适用于 Windows 8 的程序版本.我的目标工作流程很简单:创建 appx 包、安装、运行 appcert.exe、卸载包、清理其他东西

I have an integration test suite that I'm trying to extend to allow testing a version of a program for Windows 8. My target work flow is simple: Create appx package, install, run appcert.exe, uninstall package, clean up other stuff

所以,我正在尝试访问 Windows.Management.Deployment 命名空间,它应该允许我执行包的所有安装和管理.问题是这个命名空间显然需要使用 .Net 的 WinRT 版本,这对我们来说是行不通的,因为它需要大量的转换,特别是因为我们不需要它作为 Windows Store 应用程序运行,并且不喜欢.还有一点是他们的文档 说:

So, I'm trying to access the Windows.Management.Deployment namespace which should allow me to do all of the installation and management of the package. Problem is that this namespace apparently requires using the WinRT version of .Net, which won't fly for us because it'd require a huge amount of conversion, especially since we don't need this to run as a Windows Store App, and prefer it not to. There is also the bit that their documentation says:

重要提示,您不能在 Windows 应用商店应用中使用此类.

Important You can't use this class in a Windows Store app.

那么你到底打算如何利用这个类!?我尝试手动添加对 Windows.winmd 的引用,但我得到您只能将 WinMD 引用添加到面向 Windows 8.0 或更高版本的项目",我不完全理解.

So how exactly are you suppose to utilize this class!? I've tried manually adding a reference to Windows.winmd, but I get "you can only add WinMD references to a project targeting Windows 8.0 or higher", which I don't entirely understand.

推荐答案

您可以使用来自桌面应用程序.

只需添加

<PropertyGroup>
    <TargetPlatformVersion>8.0</TargetPlatformVersion>
</PropertyGroup>

.csproj.

这篇关于如何访问 Windows.Management.Deployment 命名空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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