简体   繁体   中英

Using older .NET API in a Modern UI application for Windows 8?

I am currently trying to make use of DropNet to make a simple Modern UI application that will be able to access users' Dropbox accounts and upload files. However, DropNet apparently only supports .NET 3.5.

I've been trying to make the application utilize the .NET 3.5 runtime (rather than 4.5), but to no avail. I choose the appropriate .NET version like so:

显示 .NET Framework 所选版本的新项目屏幕截图

Yet when I try to confirm the version, it shows a greyed out box like this:

在此处输入图片说明

This contrasts with non Modern UI apps, which show the appropriate version and give you the ability to change it.

When I try to obtain DropNet through NuGet, it throws up an error (as you'd probably expect):

Could not install package 'DropNet 1.9.3'. You are trying to install this package into a project that targets '.NETCore,Version=v4.5', but the package does not contain any assembly references that are compatible with that framework. For more information, contact the package author.

Is there any way to achieve what I'm trying to do?

You cannot make this work. A Store app project must target .NET 4.5, the only version of .NET that's compatible with the language projection that's needed to make .NET programs work on WinRT. In addition, the profile that permits WinRT programming (.NETCore as shown in the error message) is strictly limited and does not support references to .NET assemblies that target older versions of .NET.

I'm not aware of a 4.5 Store compatible wrapper for the DropBox api. You could possible take advantage of their generic REST api . Beware the general trouble you'll have making it work, and surely the reason that a 4.5 wrapper isn't available, Windows suspends a Store app when the user switches away from it. Which will interrupt a file transfer. A highly likely occurrence, the user won't have much patience with it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM