C# – OnExit is not entering via PostSharp in asp.net project

asp.netccilpostsharp

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

Best Answer

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).