Import Attribut Commandline
5 posts • Page 1 of 1
Import Attribut Commandline
Hello Community,
I need an example for import an attribut in a assembly with the commandline-Tool.
This works!!!
My problem is, I will automatically import the following line in my Assembly:
[assembly: Tracer.TraceAspect(AttributeTargetTypes = "MyNamespace.*")]
Please help me! Where is a help of Configurationfile?
Thank you
Mathias Reis
I need an example for import an attribut in a assembly with the commandline-Tool.
- Code: Select all
"C:\Program Files\PostSharp 1.0\Postsharp.exe" "C:\Program files\PostSharp 1.0\Default.psproj" "D:\REISM\Visual Studio 2005\Projects\Testprojekte\tracer_postsharp\tester.App.TracerPostsharp.PostSharpEnhanced\bin\Debug\tester.App.TracerPostsharp.PostSharpEnhanced.dll" /P:Output="D:\REISM\Visual Studio 2005\Projects\Testprojekte\tracer_postsharp\tester.App.TracerPostsharp.PostSharpEnhanced\bin\Debug\Test.dll" /p:IntermediateDirectory=. /P:SignAssembly=true /P:CleanIntermediate=false /P:PrivateKeyLocation="D:\REISM\Visual Studio 2005\Projects\Testprojekte\tracer_postsharp\tracer_postsharp\tester.snk" /P:SearchPath="D:\REISM\Visual Studio 2005\Projects\Testprojekte\tracer_postsharp\tracer_postsharp\bin\Debug\Tracer.dll"
This works!!!
My problem is, I will automatically import the following line in my Assembly:
[assembly: Tracer.TraceAspect(AttributeTargetTypes = "MyNamespace.*")]
Please help me! Where is a help of Configurationfile?
Thank you
Mathias Reis
Last edited by mreis on Sun Apr 27, 2008 8:04 pm, edited 1 time in total.
Re: Import Attribut Commandline
Hi,
There is no off-the-shelf way currently. You have to have the source code and to add the custom attribute to the code.
Alternatively, you can develop a custom task (ICustomAttributeProvider) using PostSharp Core and include it in the PostSharp project.
Gael
There is no off-the-shelf way currently. You have to have the source code and to add the custom attribute to the code.
Alternatively, you can develop a custom task (ICustomAttributeProvider) using PostSharp Core and include it in the PostSharp project.
Gael
Re: Import Attribut Commandline
Hallo Gael,
thanks for your answer. I have another question, the following line is implement in my project:
[assembly: TraceAspect(AttributeTargetElements = PostSharp.Extensibility.MulticastTargets.Method)]
I think, the AttributeTargetElements to filter the Assembly and import the functions only in "Methods" of the project. That is not correct. It is implement in all Elements (Propeties, Constructors ...) What can I do?
Mathias
thanks for your answer. I have another question, the following line is implement in my project:
[assembly: TraceAspect(AttributeTargetElements = PostSharp.Extensibility.MulticastTargets.Method)]
I think, the AttributeTargetElements to filter the Assembly and import the functions only in "Methods" of the project. That is not correct. It is implement in all Elements (Propeties, Constructors ...) What can I do?
Mathias
Re: Import Attribut Commandline
This should apply the aspect to all methods, including property and event accessors, but not on constructors.
Re: Import Attribut Commandline
Hallo Gael,
that is an error. Its also in Constructors. Look the following section:
I have only include the Attribut:
[assembly: TraceAspect(AttributeTargetElements = PostSharp.Extensibility.MulticastTargets.Method)]
What can I do?
Very thanks for your help
Mathias
that is an error. Its also in Constructors. Look the following section:
- Code: Select all
public Kunde()
{
MethodExecutionEventArgs ~laosEventArgs~1;
try
{
~laosEventArgs~1 = new MethodExecutionEventArgs(methodof(Kunde..ctor, Kunde), this, null);
~PostSharp~Laos~Implementation.TraceAspectAttribute~10.OnEntry(~laosEventArgs~1);
if (~laosEventArgs~1.FlowBehavior != FlowBehavior.Return)
{
~PostSharp~Laos~Implementation.TraceAspectAttribute~10.OnSuccess(~laosEventArgs~1);
}
}
catch (Exception ~exception~0)
{
~laosEventArgs~1.Exception = ~exception~0;
~PostSharp~Laos~Implementation.TraceAspectAttribute~10.OnException(~laosEventArgs~1);
switch (~laosEventArgs~1.FlowBehavior)
{
case FlowBehavior.Continue:
case FlowBehavior.Return:
return;
}
throw;
}
finally
{
~PostSharp~Laos~Implementation.TraceAspectAttribute~10.OnExit(~laosEventArgs~1);
}
}
I have only include the Attribut:
[assembly: TraceAspect(AttributeTargetElements = PostSharp.Extensibility.MulticastTargets.Method)]
What can I do?
Very thanks for your help
Mathias
5 posts • Page 1 of 1