我有一个wpf应用程序,它从.xaml文件中读取动态创建视图。但是,当安装在非开发机器上时,程序会说该程序未经授权访问存储文件的路径。我们使用相对路径来读取文件。有什么建议吗?
答案 0 :(得分:0)
只有您授予对Program Files
文件夹的访问权限才能Creating and Embedding an Application Manifest (UAC)。
举个例子:
Executable: IsUserAdmin.exe
Manifest:IsUserAdmin.exe.manifest
Sample application manifest file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0"
processorArchitecture="X86"
name="IsUserAdmin"
type="win32"/>
<description>Description of your application</description>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
但你肯定必须go and read the API。