PostSharp.exe issue

Questions about integration in Visual Studio, MSBuild or other IDEs or build tools.

PostSharp.exe issue

Postby Pierrus on Wed Dec 05, 2007 11:48 am


Hello,

I'm currently encountering a weird issue. I hava a Postharp enabled project, that gets code injected when it gets compiled in Visual Studio 2005. Everything works fine in this case.

However, I'm unable to get it post compiled using command line tool postsharp.exe.

When using Postsharp.exe, I get this message:

PostSharp 1.0 [1.0.7.261] - Copyright (c) Gael Fraiteur and Community, 2005-2007.

info PS0035: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ilasm.exe "E:\Projects\Users\B4All Output\Binaries\B4ALL-Ayamee Debug\Subsonic.il" /QUIET /DLL /DEBUG "/RESOURCE=E:\Projects\Users\B4All Output\Binaries\B4ALL-Ayamee Debug\Subsonic.res" "/OUTPUT=E:\Projects\Users\B4All Output\Binaries\B4ALL-Ayamee Debug\Subsonic_PS.dll" /SUBSYSTEM=3 /FLAGS=1 /BASE=4194304 /STACK=1048576 /ALIGNMENT=4096 /MDV=v2.0.50727


And no aspect is injected in the postsharped dll (library_PS.dll) which has actually the exact same size in KB as the original one (library.dll).

Here is what my .psproj file looks like:

<!-- Default project used when PostSharp is detected according to project references. -->
<Project xmlns="[url=http://schemas.postsharp.org/1.0/configuration]http://schemas.postsharp.org/1.0/configuration[/url]" ReferenceDirectory="{$ReferenceDirectory}">
 
    <!-- Provide internal, unmerged task specification -->
    <TaskType Name="Hmg.Core.Aspects.SelfWeaving.Task.Internal" Implementation="Hmg.Core.Common.Aspects.SelfWeavingTask, Hmg.Core.Common.Aspects">
    <Dependency TaskType="CodeWeaver"/>
    </TaskType>
 
    <!-- Set of tasks -->
    <Tasks>
        <!-- All other tasks should be automatically detected by this one. -->
        <AutoDetect />

        <!-- Compiles back the file. -->
        <Compile TargetFile="{$Output}"
                 IntermediateDirectory="{$IntermediateDirectory}"
                 CleanIntermediate="{$CleanIntermediate}"/>
    </Tasks>
</Project>


Thanks for your help,

Pierre
Pierre Murasso
Pierrus
 
Posts: 8
Joined: Sat Jan 12, 2008 4:55 pm
Full Name: Pierre Murasso

Re: PostSharp.exe issue

Postby Pierrus on Tue Dec 11, 2007 12:54 pm


Hello guys,

Is there anybody out there?
Pierre Murasso
Pierrus
 
Posts: 8
Joined: Sat Jan 12, 2008 4:55 pm
Full Name: Pierre Murasso

Re: PostSharp.exe issue

Postby gfraiteur on Tue Dec 11, 2007 3:05 pm

Yes!
It seems the notification system does not work completely...

I will have to get another forum!

I suggest you enable tracing in PostSharp-Library.config:

Trace = true
Trace.AutoDetectTask = true
Trace.ProjectLoader = true

Gael
Gael Fraiteur, project leader
got good support? consider donating to the project.
gfraiteur
Site Admin
 
Posts: 674
Joined: Tue Dec 18, 2007 3:09 pm
Full Name: Gael Fraiteur
Company: postsharp.org

Re: PostSharp.exe issue

Postby Pierrus on Wed Jan 09, 2008 12:46 pm


Hello Gael,


I modified PostSharp-Library.config as you told me. Here is the output of the postcompilation process.

[exec] PostSharp 1.0 [1.0.7.261] - Copyright (c) Gael Fraiteur and Community, 2005-2007.
     [exec] debug ProjectLoader: Setting the ReferenceDirectory property to the working directory {E:\Projects\Users\B4ALL output\Binaries\B4ALL-Ayamee\20080109-1240} because it was not defined externally.
     [exec] debug ProjectLoader: The project reference directory is {E:\Projects\Users\B4ALL output\Binaries\B4ALL-Ayamee\20080109-1240}.
     [exec] debug ProjectLoader: Loading the application confiration.
     [exec] debug ProjectLoader: Loading configuration from file {C:\Program Files\PostSharp 1.0\PostSharp-Platform.config}, reference directory = {}.
     [exec] debug ProjectLoader: Adding {C:\Program Files\PostSharp 1.0} to the search path because it contains the file {PostSharp-Platform.config}.
     [exec] debug ProjectLoader: Adding {C:\Program Files\PostSharp 1.0\\PlugIns} to the search path because of a SearchPath element (relatively to directory {C:\Program Files\PostSharp 1.0})..
     [exec] debug ProjectLoader: Adding {C:\Documents and Settings\Pierre\Application Data\PostSharp 1.0} to the search path because of a SearchPath element (relatively to directory {C:\Program Files\PostSharp 1.0})..
     [exec] debug ProjectLoader: Loading the project E:\Projects\Users\B4All tools\Ayamee.psproj.
     [exec] debug ProjectLoader: Loading configuration from file {E:\Projects\Users\B4All tools\Ayamee.psproj}, reference directory = {{$ReferenceDirectory}}.
     [exec] debug ProjectLoader: Adding {E:\Projects\Users\B4All tools} to the search path because it contains the file {Ayamee.psproj}.
     [exec] debug ProjectLoader: Adding {E:\Projects\Users\B4All tools} to the search path because it is the reference directory for the file {Ayamee.psproj}.
     [exec] debug ProjectLoader: Adding task AutoDetect explicitely.
     [exec] debug ProjectLoader: Adding task Compile explicitely.
     [exec] debug ProjectLoader: Adding task CustomAttributeDictionary because it is required by task AutoDetect.
     [exec] debug ProjectLoader: Adding task ModuleCustomAttributeProvider because it is required by task CustomAttributeDictionary.
     [exec] debug ProjectLoader: Adding task TypeHierarchyAnalysis because it is required by task CustomAttributeDictionary.
     [exec] debug ProjectLoader: Adding task IndexGenericInstances because it is required by task CustomAttributeDictionary.
     [exec] debug ProjectLoader: Adding task MulticastAttribute because it is required by task AutoDetect.
     [exec] debug ProjectLoader: Adding task Globals because it is required by task AutoDetect.
     [exec] debug ProjectLoader: Adding task DisableMessages because it is required by task AutoDetect.
     [exec] debug ProjectLoader: Adding {E:\Projects\Users\B4ALL output\Binaries\B4ALL-Ayamee\20080109-1240} to the search path because it contains the source module.
     [exec] debug ProjectLoader: Executing phase {Load} on module {Subsonic.dll}.
     [exec] debug ProjectLoader: Executing task {DisableMessages}.
     [exec] debug ProjectLoader: Executing phase {Analyze} on module {Subsonic.dll}.
     [exec] debug ProjectLoader: Executing task {Globals}.
     [exec] debug ProjectLoader: Executing task {IndexGenericInstances}.
     [exec] debug ProjectLoader: Executing task {TypeHierarchyAnalysis}.
     [exec] debug ProjectLoader: Executing task {CustomAttributeDictionary}.
     [exec] debug ProjectLoader: Executing task {MulticastAttribute}.
     [exec] debug ProjectLoader: Executing task {AutoDetect}.
     [exec] debug AutoDetectTask: Detected instance of the custom attribute {[B4ALL.Events.Aspects]B4ALL.Events.Aspects.RegisterEventAttribute} requiring PostSharp.
     [exec] debug ProjectLoader: Finding file {PostSharp.Laos.psplugin}.
     [exec] debug ProjectLoader: Probing {C:\Program Files\PostSharp 1.0\PostSharp.Laos.psplugin}.
     [exec] debug ProjectLoader: Loading the plugin configuration C:\Program Files\PostSharp 1.0\PostSharp.Laos.psplugin.
     [exec] debug ProjectLoader: Loading configuration from file {C:\Program Files\PostSharp 1.0\PostSharp.Laos.psplugin}, reference directory = {}.
     [exec] debug ProjectLoader: Adding {C:\Program Files\PostSharp 1.0} to the search path because it contains the file {PostSharp.Laos.psplugin}.
     [exec] debug ProjectLoader: Back to .
     [exec] debug AutoDetectTask: Adding the task {PostSharp.Laos}.
     [exec] debug ProjectLoader: Adding task PostSharp.Laos explicitely.
     [exec] debug ProjectLoader: Adding task CodeWeaver because it is required by task PostSharp.Laos.
     [exec] debug ProjectLoader: Adding task IndexUsages because it is required by task CodeWeaver.
     [exec] debug ProjectLoader: Adding task ImplementationBoundAttributes because it is required by task CodeWeaver.
     [exec] debug ProjectLoader: Adding task Remove because it is required by task PostSharp.Laos.
     [exec] debug ProjectLoader: Adding task PostSharp.Laos.BuiltInAspectWeaverFactory because it is required by task PostSharp.Laos.
     [exec] debug AutoDetectTask: Detected 1 plugin(s) and 1 task(s).
     [exec] debug ProjectLoader: Executing task {ImplementationBoundAttributes}.
     [exec] debug ProjectLoader: Executing task {IndexUsages}.
     [exec] debug ProjectLoader: Executing phase {Transform} on module {Subsonic.dll}.
     [exec] debug ProjectLoader: Executing task {PostSharp.Laos}.
     [exec] debug ProjectLoader: Executing task {CodeWeaver}.
     [exec] debug ProjectLoader: Executing phase {Generate} on module {Subsonic.dll}.
     [exec] debug ProjectLoader: Executing task {Remove}.
     [exec] debug ProjectLoader: Executing task {Compile}.
     [exec] info PS0035: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ilasm.exe "E:\Projects\Users\B4ALL output\Binaries\B4ALL-Ayamee\20080109-1240\Subsonic.il" /QUIET /DLL "/RESOURCE=E:\Projects\Users\B4ALL output\Binaries\B4ALL-Ayamee\20080109-1240\Subsonic.res" "/OUTPUT=E:\Projects\Users\B4ALL output\Binaries\B4ALL-Ayamee\20080109-1240\Subsonic_PS.dll" /SUBSYSTEM=3 /FLAGS=1 /BASE=4194304 /STACK=1048576 /ALIGNMENT=4096 /MDV=v2.0.50727
Pierre Murasso
Pierrus
 
Posts: 8
Joined: Sat Jan 12, 2008 4:55 pm
Full Name: Pierre Murasso

Re: PostSharp.exe issue

Postby Pierrus on Wed Jan 09, 2008 1:04 pm


Gael,

One more thing. Here is what the command line postcompilation call looks like. Does it appear correct to you?

'C:\Program Files\PostSharp 1.0\PostSharp.exe
 ( "E:\Projects\Users\B4All tools\Ayamee.psproj"
 "E:\Projects\Users\B4ALL output\Binaries\B4ALL-Ayamee\20080109-1300\Subsonic.dll"
 "/p:SearchPath=E:\Projects\Users\B4ALL output\Binaries\B4ALL-Ayamee\20080109-1300"
 "/p:Output=E:\Projects\Users\B4ALL output\Binaries\B4ALL-Ayamee\20080109-1300\Subsonic_PS.dll"
 "/p:IntermediateDirectory=E:\Projects\Users\B4ALL output\Binaries\B4ALL-Ayamee\20080109-1300"
 /p:CleanIntermediate=false
 "/p:DependenciesDirectory=E:\Projects\Users\B4ALL output\Binaries\B4ALL-Ayamee\20080109-1300")'
Pierre Murasso
Pierrus
 
Posts: 8
Joined: Sat Jan 12, 2008 4:55 pm
Full Name: Pierre Murasso

Re: PostSharp.exe issue

Postby gfraiteur on Wed Jan 09, 2008 1:42 pm

No idea. It seems that everything works as it should.
Gael Fraiteur, project leader
got good support? consider donating to the project.
gfraiteur
Site Admin
 
Posts: 674
Joined: Tue Dec 18, 2007 3:09 pm
Full Name: Gael Fraiteur
Company: postsharp.org


Return to Integration with IDE and Build Scripts