Permissions View Tool (Permview.exe)
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.
permview [/output filename] [/decl] manifestfile
|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.|
|/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.|
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 displays the permissions requested by the assembly
myAssembly.exe to the console.
myAssembly.exe contains a minimum request for FullTrust, the following output appears.
Microsoft (R) .NET Framework Permission Request Viewer. Version 1.0.2204.18 Copyright (C) Microsoft Corp. 1998-2000 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) .NET Framework Permission Request Viewer. Version 1.0.2204.18 Copyright (C) Microsoft Corp. 1998-2000 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, Ver=1.0.2204.2, Loc='', SN=03689116d3a4ae33" version="1"> <MemberAccess/> </Permission> </PermissionSet>
The following command writes the permissions requested by the assembly
myAssembly.exe to the file
permview /output myOutputFile myAssembly.exe