views:

63

answers:

1

Is there any util or any other way to check what permissions a C# application needs to run without problems?
I have a somewhat big application code that i'm not familiar with and i thought if there's a way to check it without going through all the code and logic it will save me a lot of time..

Thanks.

+2  A: 

This may be too crude a tool, but the .NET Framework SDK includes a tool called permcalc (Permission Calculator):

The Minimum Grant Set Determination tool calculates the minimum permission set required to run an application by examining all applicable code paths of all application assemblies and dependency assemblies. The tool returns a permission set per application assembly.

See http://msdn.microsoft.com/en-us/library/ms165077%28VS.80%29.aspx for more details and to see if it will be applicable for your scenario.

itowlson
It works only if the programmer explicitly asked for a permission?
Nimrod Shory
It's a static analysis tool, so it won't catch where the code just assumes that it has permissions on particular resources such as specific files or registry entries. On the other hand, it does recurse into system libraries, so a piece of code that e.g. accesses a registry key should throw up the registry permission demanded by the registry API. I haven't tested this though.
itowlson