Question

I want to run Castle.Core under medium trust, and I know how to do it in theory.

  1. Add [AllowPatiallyTrustedCallers] to the Assembly.cs
  2. Disable Trace Logger - (because it uses reflection)

First problem, there is is no Assembly.cs, so apparently you can use nant to build with a command line like:

nant -D:assembly.allow-partially-trusted-callers=true

But that returns an error

NAnt 0.84 (Build 0.84.1455.0; net-1.0.win32; release; 26/12/2003)
Copyright (C) 2001-2003 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///D:/Downloads/development - source/Castle Proxy/Core/src/Castl
e.Core/default.build
Target(s) specified: nant

BUILD FAILED

Property 'project::get-name()' has not been set.

Total time: 0.1 seconds.

How do I set this or resolve the issue? The svn for this the Castle.Core is https://svn.castleproject.org/svn/castle/Core/trunk so your welcome to check it out before answering if you want

Was it helpful?

Solution

[UPDATE]

OK, my bad. I'm not an expert in medium trust issues, but the way I understand it, you need APTCA on Castle assemblies after all.

So here's what I did:

I pulled Castle Core from: https://svn.castleproject.org/svn/castle/Core/trunk downloaded latest nightly build of NAnt and built it with nant build -D:assembly.allow-partially-trusted-callers=true

I then downloaded Dynamic Proxy from: https://svn.castleproject.org/svn/castle/DynamicProxy/trunk

copied the Core assembly I built in previous step to lib/net-35 and then built DP with the same Nant command.

I then created an ASP.NET website with trust level set to Medium and generated a couple of proxies in it, and it worked.

If for some reason that does not work for you, or you have any other issues/suggestions let me know.

OTHER TIPS

I think you're going the wrong way about it - You don't need to add [AllowPatiallyTrustedCallers] to run in medium trust. You only need APTCA if you're going to GAC the assembly, in which case you wouldn't need to remote Trace Logger because GACed assemblies run in full trust and reflection would work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top