Thursday, March 15, 2007

Running an assembly from an intranet share

I needed this to be able to access an executable on a network share without opening up for executing all Intranet assemblies. The recommended way is to use the strong name for the assembly, this was surprisingly easy (this info can be had all over the internet):
  1. Create a key: sn -k mykey.snk
  2. Add "[assembly: AssemblyKeyFile("mykey.snk")]" to the AssemblyInfo.cs
  3. Compile :)
To allow this particular assembly to be loaded and run:
  1. Run ".NET Framework 2 Configuration" (to be found under Administrative Tools)
  2. Navigate to My Computer->Runtime Security Policy->Machine->Code Groups
  3. Right click on All_Code and select New and give it some name. Next
  4. Select "Strong Name" and click on Import
  5. Select the assembly/executable in question. Next
  6. Select FullTrust

No comments: