Sam

could you post that to the wiki:
http://using.castleproject.org/display/CASTLE/Castle+Project

it would be more easily discoverable... google thread will disappear quickly and we'll have people asking the same question over again.

cheers,

Krzysztof

On 2010-01-23 00:45, Sam Kimmel wrote:
Thanks xtoff.  When I saw the assemblies you posted I realized that
both the Core and the Dynamic Proxy were rebuilt.  I was only
rebuilding the Dynamic Proxies.

Just in case anyone else is interested in getting NHibernate + Castle
Dynamic Proxy working in medium trust, this is what you need to do:

1. If you don't have a SVN client, you'll need to download one.  I
used SubCommander (http://subcommander.tigris.org/), and while there
seem to be a couple quirky interface bugs, it did allow me to download
the trunks to the directories of my choice.
2. Download Nant (I used 0.86 beta) from http://nant.sourceforge.net/.
To install:
    a. Extract it to a directory
    b. Create a file called nant.bat with the following contents and
save it in C:\Windows
           @echo off
           "C:\<Path_To_Nant>\bin\NAnt.exe" %*

3. Download Castle Core from the svn: 
https://svn.castleproject.org/svn/castle/Core/trunk
     a. Edit the file buildscripts\CommonAssemblyInfo.cs and add the
following:
           using System.Security;
           [assembly: AllowPartiallyTrustedCallers]
           (**Note**: I added this because the nant parameter below
didn't seem to do inject it)
     b. Open the command prompt and navigate to the root directory,
then run:
           nant -D:assembly.allow-partially-trusted-callers=true clean
merge build

4. Download Castle Dynamic Proxies from the svn:
https://svn.castleproject.org/svn/castle/DynamicProxy/trunk
     a. Copy the Castle.Core.dll from the build directory in Step 3
into the lib directory of the Dynamic Proxy project
     b. Open the command propomt and navigate to the root directory,
then run:
          nant -D:assembly.allow-partially-trusted-callers=true clean
merge build

5. Download the NHibernate source from: 
http://sourceforge.net/projects/nhibernate/files/
     a. Open src\NHibernate.Everything.sln in Visual Studio
     b. Expand the NHibernate.ByteCode.Castle project
         i. Delete the references to Castle.Core and
Castle.DynamicProxy2 and replace them with the assemblies created in
steps 3&  4
         ii.  Build NHibernate.ByteCode.Castle

6.  Open the projects you are working on that require medium trust
      a. Update the references to Castle.Core, Castle.DynamicProxy2,
and NHibernate.ByteCode.Castle in your project
      b. Make sure you have the [assembly:
AllowPartiallyTrustedCallers] attribute in the AssemblyInfo.cs file
for each of your own projects
      c. When setting up your NHibernate configuration, do this:
            /* for whatever reason, the<reflection-optimizer
use="false"/>  is being ignored in hibernate.cfg.xml, so we need this
*/
            NHibernate.Cfg.Environment.UseReflectionOptimizer = false;
            config = new Configuration().Configure();

7. Build your projects and run your web pages in Medium Trust!

On Jan 22, 2:02 pm, xtoff<krzysztof.koz...@gmail.com>  wrote:
http://groups.google.com/group/castle-project-users/web/APTCA-DP-UNSU...

On 22 Sty, 20:32, Sam Kimmel<sweep...@gmail.com>  wrote:



Krzysztof,
Thanks again.  What you said makes sense. Unfortunately, I don't think the
command is working. Should the final assembly sill end up in *debug
*directory?
I put in the fresh assembly and rebuilt the NHibernate.ByteCode.Castle
project and my project but still get the same permission error (below).  Do
I need a different version of NAnt? I've tried NAnt 0.85 and 0.86 beta.
In Matijn Boland's
blog<http://blogs.taiga.nl/martijn/2009/06/24/new-adventures-under-medium-...>he
talked about adding the APTCA attribute and needing to make a
modification to the code so that debug info wasn't emitted for
AssemblyBuilder.DefineDynamicModule. The svn trunk already had this
modification made (ModuleScope class). So I don't think that is the problem.
Medium Trust seems like a fairly common restraint put on shared hosting
customers.  How difficult would it be for the Castle team to set up the
build process to output DynamicProxy2.dll and a DynamicProxy2MT.dll (with a
disclaimer saying that the 2MT version should only be used when Medium Trust
is the only option)?
Is there anyone out there  with a working Medium Trust version of Dynamic
Proxy 2.2 that would be willing to share the final assembly?
==========================
[SecurityException: That assembly does not allow partially trusted
callers.]
    Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly,
INamingScope namingScope, String strongAssemblyName, String
strongModulePath, String weakAssemblyName, String weakModulePath) +0
    Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly,
String strongAssemblyName, String strongModulePath, String
weakAssemblyName, String weakModulePath) +75
    Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly)
+62
    Castle.DynamicProxy.ModuleScope..ctor() +31
    Castle.DynamicProxy.DefaultProxyBuilder..ctor() +44
    Castle.DynamicProxy.ProxyGenerator..ctor() +44
    NHibernate.ByteCode.Castle.ProxyFactory..cctor() +49
=============================
2010/1/22 Krzysztof Koźmic (2)<krzysz...@kozmic.pl>
Sam,
sorry for the inconvenience, we are changing our build, moving away
from nant.
try to build with the following command (assuming you have NAnt in
your PATH)
nant -D:assembly.allow-partially-trusted-callers=true clean merge
build
about the reasons for not providing APTCA assemblies OOTB see this
thread:
http://groups.google.com/group/castle-project-devel/browse_thread/thr...
On 22 Sty, 09:33, Sam Kimmel<sweep...@gmail.com>  wrote:
Thanks Krzysztof.  I downloaded Nant and haven't had any luck building
from the trunk.  I went to the buildscripts folder and ran the
build.cmd as per the instructions.  When I ran it I got an error:
=======================
This project is not configured to be built with MSBuild.
Please use the NAnt script in the root folder of this project.
=======================
So then I went back to the root and ran NAnt. Exactly where do I need
to specify to allow partially trusted callers?  Also is there a way to
get it to do a release build instead of a debug?  Below are the
results of the NAnt process...
But before that, exactly what are the security reasons for not
providing a AllowPartiallyCallers version? If web users have to go
beyond Medium Trust to use Dynamic Proxy aren't they already making
their app less secure?
=======================
NAnt 0.86 (Build 0.86.2898.0; beta1; 12/8/2007)
Copyright (C) 2001-2007 Gerry Shawhttp://nant.sourceforge.net
Buildfile: file:///C:/Web/CastleDynamicProxy/default.build
Target framework: Microsoft .NET Framework 3.5
Target(s) specified: build
common.find-svninfo:
      [exec] C:\Web\CastleDynamicProxy\buildscripts\common.xml(195,4):
      [exec] 'svn' failed to start.
   [xmlpeek] Peeking at 'C:\Web\CastleDynamicProxy\_revision.xml' with
XPath expression '/info/entry/@revision'.
   [xmlpeek] C:\Web\CastleDynamicProxy\buildscripts\common.xml(206,4):
   [xmlpeek] XML file 'C:\Web\CastleDynamicProxy\_revision.xml' does
not exist.
      [echo] INFO: Using Subversion revision number: 0
common.build:
common.build.internal:
      [nant] C:\Web\CastleDynamicProxy\src\Castle.DynamicProxy
\default.build
             Buildfile:
file:///C:/Web/CastleDynamicProxy/src/Castle.DynamicProxy/default.build
             Target framework: Microsoft .NET Framework 3.5
             Target(s) specified: build
             common.find-svninfo:
                  [exec] C:\Web\CastleDynamicProxy\buildscripts
\common.xml(195,4):
                  [exec] 'svn' failed to start.
               [xmlpeek] Peeking at 'C:\Web\CastleDynamicProxy\src
\Castle.DynamicProxy\_revision.xml' with XPath expression '/info/entry/
@revision'.
               [xmlpeek] C:\Web\CastleDynamicProxy\buildscripts
\common.xml(206,4):
               [xmlpeek] XML file 'C:\Web\CastleDynamicProxy\src
\Castle.DynamicProxy\_revision.xml' does not exist.
                  [echo] INFO: Using Subversion revision number: 0
             set-framework-configuration:
                [script] Scanning assembly "op4sf4wa" for extensions.
             set-net-3.5-framework-configuration:
             set-project-configuration:
             set-debug-project-configuration:
             common.init:
             init:
             common.set-assembly-attribute-values:
             common.generate-assemblyinfo:
                [attrib] Setting file attributes for 1 files to Normal.
             common.copy.project.references:
                  [copy] Copying 1 file to 'C:\Web\CastleDynamicProxy
\build\net-3.5\debug'.
                  [copy] Copying 1 file to 'C:\Web\CastleDynamicProxy
\build\net-3.5\debug'.
                  [copy] Copying 1 file to 'C:\Web\CastleDynamicProxy
\build\net-3.5\debug'.
                  [copy] Copying 1 file to 'C:\Web\CastleDynamicProxy
\build\net-3.5\debug'.
             common.compile-dll:
             build:
             BUILD SUCCEEDED - 2 non-fatal error(s), 0 warning(s)
             Total time: 1 seconds.
      [nant] C:\Web\CastleDynamicProxy\src\Castle.DynamicProxy.Tests
\default.build
             Buildfile:
file:///C:/Web/CastleDynamicProxy/src/Castle.DynamicProxy.Tests/default.bui­ld
             Target framework: Microsoft .NET Framework 3.5
             Target(s) specified: test
             common.find-svninfo:
                  [exec] C:\Web\CastleDynamicProxy\buildscripts
\common.xml(195,4):
                  [exec] 'svn' failed to start.
               [xmlpeek] Peeking at 'C:\Web\CastleDynamicProxy\src
\Castle.DynamicProxy.Tests\_revision.xml' with XPath expression '/info/
entry/@revision'.
               [xmlpeek] C:\Web\CastleDynamicProxy\buildscripts
\common.xml(206,4):
               [xmlpeek] XML file 'C:\Web\CastleDynamicProxy\src
\Castle.DynamicProxy.Tests\_revision.xml' does not exist.
                  [echo] INFO: Using Subversion revision number: 0
             set-framework-configuration:
                [script] Scanning assembly "waldny83" for extensions.
             set-net-3.5-framework-configuration:
             set-project-configuration:
             set-debug-project-configuration:
             common.init:
             common.copy.project.references:
                  [copy] Copying 1 file to 'C:\Web\CastleDynamicProxy
\build\net-3.5\debug'.
                  [copy] Copying 1 file to 'C:\Web\CastleDynamicProxy
\build\net-3.5\debug'.
                  [copy] Copying 1 file to 'C:\Web\CastleDynamicProxy
\build\net-3.5\debug'.
                  [copy] Copying 1 file to 'C:\Web\CastleDynamicProxy
\build\net-3.5\debug'.
             init:
             common.compile-tests:
             common.set-assembly-attribute-values:
             common.generate-assemblyinfo:
                [attrib] Setting file attributes for 1 files to Normal.
             common.copy.project.references:
                  [copy] Copying 1 file to 'C:\Web\CastleDynamicProxy
\build\net-3.5\debug'.
                  [copy] Copying 1 file to 'C:\Web\CastleDynamicProxy
\build\net-3.5\debug'.
                  [copy] Copying 1 file to 'C:\Web\CastleDynamicProxy
\build\net-3.5\debug'.
                  [copy] Copying 1 file to 'C:\Web\CastleDynamicProxy
\build\net-3.5\debug'.
             common.compile-dll:
             common.configure-tests:
                [attrib] Setting file attributes for 1 files to Normal.
               [xmlpoke] No matching nodes were found with XPath
expression '/configuration/appSettings/a...@key='tests.src']/@value'.
...

read more »- Hide quoted text -

- Show quoted text -

--
You received this message because you are subscribed to the Google Groups "Castle 
Project Users" group.
To post to this group, send email to castle-project-us...@googlegroups.com.
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to