Question : Full Trust granting for Assembly in x64

I have a very simple C# tool that grants trust to an entire directory. This tool works fine for 32bit Windows but does not work in 64bit Windows. No errors are given. I assume that I am missing something in the steps.

1. I find the Policy Level in the Security.PolicyHierarchy for "Machine"

2. I then create a new PermissionSet for "FullTrust"

3. I create a new PolicyStatement with the new PermissionSet

4. I create a new IMembershipCondition for the directory of the assembly (i.e. "c:\\program files (x86)\\product\\*")

5. I creaet a new CodeGroup with the MembershipCondition and PolicyStatement

6. I give the CodeGroup a name and description, then add it to the Machine's PolicyLevel as a child of RootCodeGroup (i.e MachinePolicyLevel.RootCodeGroup.AddChild(CodeGroup)

7. I then call SecurityManager.SavePolicy

The code runs fine, but the new MemberShip condition is not showing under the FullTrust permission set only on x64 machines. x32 machines, no problem.

What do you think?

Answer : Full Trust granting for Assembly in x64

Okay... maybe the problem is something else.

In the Excel Add-In manager, I get the following message:

Load Behavior: Not loaded. A runtime error occurred during the loading of the COM Add-In.

When I go to ".NET Framework 2.0 Configuration" tool, under My Computer | Runtime Security Policy | Machine | Permission Sets | FullTrust... I see nothing. In my 32-bit version of Windows, this is where my addin is listed.

Random Solutions  
 
programming4us programming4us