views:

216

answers:

1

Hi there,

I have setup PostSharp and it appears to be working but i don't get it entering OnExit (i have logged setup to ensure it is working) ...

Its a bit tricky to configure with asp.net - or is it just me ... I am using the 1.5 new version

I basically have the following in my web.config and i had to add the SearchPath otherwise it can't find my assemblies

  <postsharp directory="C:\Program Files\PostSharp 1.5" trace="true">
   <parameters>
     <!--<add name="parameter-name" value="parameter-value"/>-->
   </parameters>
   <searchPath>
     <!-- Always add the binary folder to the search path. -->
     <add name="bin" value="~\bin"/>
   </searchPath>

 </postsharp>

I have set tracing on but what is strange to me is that it appears to build to the temp directory, maybe this is my issue, i am unsure .. hence i do F5 ... Is it possible to name the Output directory and output file?? As you can see it is editing a DLL in the temp dir so IIS is no longer in control so it doesn't execute it ???

Confused! :-)


C:\Program Files\PostSharp 1.5\postsharp.exe "/P:Output=C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mysitemvc-1.2\c2087140\8ac2dc93\postsharp\App_Web_04ae3ewy.dll" "/P:IntermediateDirectory=C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mysitemvc-1.2\c2087140\8ac2dc93\postsharp " /P:CleanIntermediate=False /P:ReferenceDirectory=. /P:SignAssembly=False /P:PrivateKeyLocation= /P:ResolvedReferences= "/P:SearchPath=C:\Source Code\Visual Studio 2008\Projects\mysitemvc\mysitemvc\bin," /V /SkipAutoUpdate "C:\Program Files\PostSharp 1.5\Default.psproj" "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mysitemvc-1.2\c2087140\8ac2dc93\before-postsharp\App_Web_04ae3ewy.dll"

PostSharp 1.5 [1.5.6.627] - Copyright (c) Gael Fraiteur, 2005-2009.

info PS0035: C:\Windows\Microsoft.NET\Framework\v2.0.50727\ilasm.exe "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mysitemvc-1.2\c2087140\8ac2dc93\postsharp\App_Web_04ae3ewy.il" /QUIET /DLL /PDB "/RESOURCE=C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mysitemvc-1.2\c2087140\8ac2dc93\postsharp\App_Web_04ae3ewy.res" "/OUTPUT=C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mysitemvc-1.2\c2087140\8ac2dc93\postsharp\App_Web_04ae3ewy.dll" /SUBSYSTEM=3 /FLAGS=1 /BASE=18481152 /STACK=1048576 /ALIGNMENT=512 /MDV=v2.0.50727

A: 

PostSharp.AspNet implement IAssemblyPostProcessor. The path is passed ASP.NET. What PostSharp does it that it creates a temp subdirectory in this directory passed by ASP.NET, writes its output there, then copies the output back to the input.

There is no way to change this mechanism (and I don't see any reason anyway).

-gael

Gael Fraiteur
ermm ok ... i didn't realised it was copied back.... so anyidea why OnExit, OnException, OnEntry are not executing... Can i provide you with more info?
mark smith
No idea. You can try to compile using aspnet_compiler then see the result using Reflector.
Gael Fraiteur
hi .. well i have checked with reflector and i see my Loggable attribute over the class.. and i see my actual class that defines loggable.. like so, so is this proof its working?[Serializable]public class LoggableAttribute : OnMethodBoundaryAspect{ // Methods public LoggableAttribute(); public override void OnEntry(MethodExecutionEventArgs event_args); public override void OnException(MethodExecutionEventArgs event_args); public override void OnExit(MethodExecutionEventArgs event_args);
mark smith