How to access the Windows.Management.Deployment namespace?

☆樱花仙子☆ 提交于 2019-12-11 00:29:51

问题


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

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:

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

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.


回答1:


You can use WinRT APIs from desktop applications.

Just add

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

to the .csproj.



来源:https://stackoverflow.com/questions/13016645/how-to-access-the-windows-management-deployment-namespace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!