If you want to exe­cute .NET assembly’s from a net­work share (as an exam­ple) you need to increase per­mis­sions for this file. Per default you are only allowed to exe­cute local .NET assem­blies.
You uniquely iden­ti­fy­ing a .NET assem­bly by added a “Strong Name”. A “Strong Name” con­sists of the pub­lic key token, cul­ture, ver­sion and PE file name. To sign a .Net assem­bly with a “Strong Name” you need the sn.exe util­ity from a MS SDK (for exam­ple the MSI SDK) and the caspol.exe util­ity from .NET v2.

Step-by-Step guide to sign a .NET assem­bly with an strong name:
1. Gen­er­ate a new key pair:

1
> sn.exe –k keypair.snk

2. Extract the pub­lic key:

1
> sn.exe –p keypair.snk pkey.pub

3. dis­as­sem­bly a.NET assemby:

1
> ildasm.exe YourFile.exe /out:YourFile.il

4. re-assembly the.NET assem­bly and sign it with an “Strong name“:

1
> ilasm.exe YourFile.il /KEY: keypair.snk

5. check the file, is it signed now?:

1
> sn.exe –vf YourFile.exe

You may add now the pub­lic key of our strong name to the local machine. But first we need to know the pub­lic key (as hex value):

1
> sn.exe –tp pkey.pub

Now we add the strong name to our workstation:

1
> caspol.exe –machine –addgroup 1 –strong –hex 002400000… –non­ame  –nover­sion Full­Trust –n “GROUP-NAME” –descrip­tion “DESCRIPTION

The default “caspol.exe” direc­tory is C:WindowsMicrosoft.NETFrameworkv2.0.50727. To ver­ify the .NET per­mis­sions use those two commands:

1
2
> caspol.exe –ld (list descrip­tion)  
> caspol.exe –lg (list groups)

The advan­tage using strong names .NET assem­bly is, you are cer­tain that the assem­bly is NOT mod­i­fied and you might increase the per­mis­sion for this assem­bly (may run directly from a share).

Another approach (but less secure) to increase .NET per­mis­sions is to add an URL as identifier:

1
> caspol.exe –machine –addgroup 1 –url \server­sharepath* Full­Trust –n “GROUP-NAME” –descrip­tion “DESCRIPTION

Group 1 (-addgroup 1) is the root code group.