本文介绍了部署需要可写文件夹的Surface 2应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的第一个WPF应用恰好是MS Surface应用。  我已准备好部署,但在部署时学到了一些未在开发中捕获的内容。  基本上,我需要写入文件系统来存储我使用
的某些.xml / .csv文件,以及需要将.doc / .docx / .pdf文件转换为.xps的顺序使用DocumentViewer。  在我的代码中,在应用程序启动时,我授予对管理这些文件的某些文件夹的写入权限。  但是,在Surface / Win7上部署时,我注意到
未授予这些权限,可能是由于UAC。

My first WPF app happens to be a MS Surface app.  I am ready to deploy, but have learned some things upon deployment that weren't caught in development.  Basically, I have a need to write to the file system to store certain .xml/.csv files I use as well as a need to convert .doc/.docx/.pdf documents to .xps in order to use DocumentViewer.  In my code, on application launch, I grant write access to certain folders that manage these files.  However, upon deployment on Surface/Win7, I notice that these permissions are not granted, probably due to UAC.

所以我把它缩小到以下问题:

So I've narrowed it down to the following issues:

1)对于驻留在/ Program Files中的应用程序中的文件夹授予写入权限可能是最佳做法

1) It is probably against best practice to grant write permissions to folders within my application that resides in /Program Files

2)I应该使用通用应用程序数据
文件夹
(C:\ProgramData)。

2a)为什么我的部署项目没有显示
公共应用程序数据 文件夹?  我确实看到"用户的应用程序数据文件夹"作为目标的选项

2b)上述文件夹(公共应用程序数据文件夹)是否不可用在MS Surface项目上?  注意:在"添加特殊文件夹"的上下文菜单中,它甚至不显示为灰色。

2c)甚至如果以上是可用的(或类似的东西),它是否仍然需要更高的权限写入?

2) I should probably be using the Common Application Data Folder (C:\ProgramData).
2a) Why doesn't my deployment project show aCommon Application Data Folder?  I do see "User's Application Data Folder" as an option to target
2b) Is the above folder (Common Application Data folder) not available on a MS Surface project?  NOTE: It doesn't even appear greyed out in the context menu for "Add Special Folder"
2c) Even if the above were available (or something similar), would it still require elevated rights to write to?

3)我可以定位不同的"内容"吗?到特定的文件夹(即一些永远不会被覆盖的文件夹可以放在/ Program Files中的
Applications 文件夹中;而其他可以覆盖的数据可以放在/ ProgramData中?

3) Can I target different "Content" to specific folders (i.e. some that are never overwritten can be placed in theApplications folder within /Program Files; while other data that can be overwritten would reside in /ProgramData)?

4)如何在我的应用程序中访问这些各种文件夹(应用程序
vs 通用应用程序数据)?  显然,在开发时,我还没有部署到任何"公共应用程序数据"夹。  如何在开发和部署之间进行管理?  实际上,我是
目前在应用程序中进行所有文件操作(尽管由于UAC而部署时它不起作用)。

4) How do I access within my Application these various folders (Applicationvs Common Application Data)?  Obviously when developing, I wouldn't have yet deployed to any "Common Application Data" folder.  How is this managed between development and deployment?  As it is, I'm currently doing all my file manipulation within the Application (though it doesn't work when deployed because of UAC).

谢谢!

推荐答案


这篇关于部署需要可写文件夹的Surface 2应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 12:25