views:

20

answers:

1

Is it possible to make a change to a project that will cause it's assembly to be executed in a different trust level? If so what is it?

From what I understand this can only be determined form outside of the project itself...

A: 

I don't think this is possible directly through the project's settings. But you could try to leverage the application domains in your project. This means that you have to change your program's code so I'm not sure if that's OK with you.

With the help of appdomains, you can create little sandboxes for each of your assemblies and run the assemblies inside their sandboxes. For every appdomain, you can change their permission sets by using the parameters in AppDomain.CreateDomain-method. Here's a good tutorial by David DeWinter on "How to Host a Partial Trust Sandbox".

Also you can use the .NET Framework Configuration tool to adjust the assembly's trust level or the caspol to give it the full trust. But these are controlled outside your project.

Mikael Koskinen