Permissions View Tool (permview.exe/permview)

The Permissions View tool is used to view the minimal, optional, and refused permission sets requested by an assembly. Optionally, you can use the Permissions View tool to view all declarative security used by an assembly.

The application file is named permview.exe on Microsoft Windows® and permview on UNIX system-based platforms.

Usage

permview [/output filename] [/decl] manifestfile

Options can be specified using either a dash (-) or a slash (/).

Argument Description
manifestfile The file that contains the assembly's manifest. The manifest can be a standalone file or it can be incorporated in a portable executable (PE) file. The extension for this file is usually .exe or .dll, but it could also be .scr, or .ocx.

Options

Option Description
/decl Displays all declarative security at the assembly, class, and method level for the assembly specified by manifestfile. This includes permission requests as well as demands, asserts, and all other security actions that can be applied declaratively. It does not refer to other assemblies linked to the specified assembly.
/h[elp] Displays command syntax and options for the tool.
/output filename Writes the output to the specified file. The default is to display the output to the console.
/? Displays command syntax and options for the tool.

When you use this tool on UNIX system-based platforms, /? might expand to a filename. Instead use the /help option variation, use -?, or enclose the /? option in quotes: "/?"

Remarks

Developers can use the Permissions View tool to verify that they have applied permission requests correctly to their code. Additionally, users can run this tool to determine the permissions an assembly requires to execute. For example, if you run a managed executable and get the error, "System.Security.Policy.PolicyException: Failed to acquire required permissions," you can use the Permissions View tool to determine the permissions the code in your executable must receive before it will execute.

Examples

The following command outputs to the console the permissions requested by the assembly myAssembly.exe.

permview myAssembly.exe

If myAssembly.exe contains a minimum request for FullTrust, the following output appears.

Microsoft (R) Shared Source CLI Permission Request Viewer. Version 1.x.x.x
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

minimal permission set:
<PermissionSet class="System.Security.PermissionSet" version ="1">
   <Unrestricted/>
</PermissionSet>

optional permission set:
   Not specified

refused permission set:
   Not specified

The following command displays all declarative security on the assembly myAssembly.exeto the console. This command displays the method-level security demand.

permview /decl myAssembly.exe

The following output appears.

Microsoft (R) Shared Source CLI Permission Request Viewer. Version 1.0.1.0
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Assembly RequestMinimum permission set:
<PermissionSet class="System.Security.PermissionSet" version ="1">
   <Unrestricted/>
</PermissionSet>

Method A::myMethod() LinktimeCheck permission set:
<PermissionSet class="System.Security.PermissionSet" version="1">
   <Permission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=1.0.3300.0, 
                      Culture=neutral, PublicKeyToken=b77a5c561934e089, version="1">
      <MemberAccess/>
   </Permission>
</PermissionSet>

The following command writes the permissions requested by the assembly myAssembly.exe to the file myOutputFile.

permview /output myOutputFile myAssembly.exe 
See Also

Tools Index


Copyright (c) 2002 Microsoft Corporation. All rights reserved.