Pregunta

I'm using PostSharp alternative called AfterThought to postprocess some of projects in my solution. Unfortunately it looks like project's post-build event command line property isn't the right extension point where to plug the post-processor in, because the compiled assembly is copied to some of the dependent projects before post-build event is fired and postprocessor run. It's interesting that the problem occurss only for web site and web service projects - dependent class libraries got post-processed version of the assembly, but I guess the core of the problem is in the post-build event is invoked too late and that I should use different event.

So I guess I need to enhance the build process/MSBuild of my projects directly in *.csproj files - is that right? And what build event is the right one for invocation of command line assembly post-processor?

¿Fue útil?

Solución 2

The final solution to my problem is CompileDependsOn target:

  <Target Name="AfterThought">
    <Exec Command="&quot;$(SolutionDir)..\LIBS\Afterthought\Afterthought.Amender.exe&quot; &quot;@(IntermediateAssembly->'%(FullPath)')&quot; &quot;$(SolutionDir)..\Amendments\bin\$(Configuration)\Amendments.dll&quot; @(ReferencePath->'&quot;%(RootDir)%(Directory).&quot;', ' ')" />
  </Target>
  <PropertyGroup>
    <CompileDependsOn>
    $(CompileDependsOn);
    AfterThought;
   </CompileDependsOn>
  </PropertyGroup>

Otros consejos

There are two:

  • <Target Name="AfterBuild" will run MSBuild commands
  • <PropertyGroup><PostBuildEvent> will run shell commands, and is accessable from Visual Studio's project dialog as "Post-build event command line" under the "Build Events" tab
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top