One way of accomplishing this is to sign your assembly with a strong name
and then write a custom install routine that modifies the security policy
for the machine your app is installed on. This routine will create a code
group whose membership condition is the strong name you signed your assembly
with and whose permission grant is full trust.
You will need to be running as an administrator when the install program is
run, and this will only work for client apps - web servers run under the
security settings imposed by IIS.
There's a book called ".NET Framework Security" by LaMacchia, Lange, etc.
that contains sample code that shows how to modify the machine policy. You
can use a standard install project and add a custom action to it that calls
the install routine with the security code.
If you have other security questions I would post them directly to the
dotnet.security newsgroup.