The Permissions View tool is used to view the minimal, optional, and refused permission sets requested by an assembly. Optionally, you can use permview.exe to view all declarative security used by an assembly.
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 either a standalone file or it can be incorporated in a portable executable (PE) file. The extension for this file will usually be .exe or .dll, but it could also be .scr, or .ocx. |
| 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 using this tool on the FreeBSD operating system /? may expand to a filename. Instead use the /help option variation, use -?, or enclose the /? option in quotes: "/?" |
Developers can use permview.exe to verify that they have applied permission requests correctly to their code. Additionally, users can run permview.exe 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 permview.exe to determine the permissions the code in your executable must receive before it will execute.
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.0.1.0 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.exe to 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
Copyright (c) 2002 Microsoft Corporation