How to access the Windows.Management.Deployment na

2019-07-18 10:39发布

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条回答
Root(大扎)
2楼-- · 2019-07-18 11:31

You can use WinRT APIs from desktop applications.

Just add

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

to the .csproj.

查看更多
登录 后发表回答