DelftShell now uses a custom build file (DelftShell.Taget) to copy necessary dlls and invoke postsharp when necessary. This means that when you create a new Assembly you have to set up some additional properties in the .csproj file.

Setting up a new project file

It is important to include these steps when you a add a new project to DelftShell (maybe we can make a template of this??). You have to make some modifications to the .csproj file by editing it in a text editor.

1 Add the following line to the project file directly below the import of Microsoft.CSharp.targets

<Import Project="..\..\..\..\..\\build\DelftShell.targets" />
This makes sure the new project is build with the DelftShell custom build logic

2
Add the following xml just before the closing </Project> tag of the project file.

<PropertyGroup>
  <IsPluginComponent>true</IsPluginComponent>
  <PluginName>$(ProjectName)</PluginName>
  <UsePostSharp>true</UsePostSharp>
</PropertyGroup>

IsPluginComponent makes sure the output of the assembly is copied to the 'loader'.
PluginName is the name of plugin project.
UsePostSharp determines if PostSharp is invoked on the dll.

What does DelftShell.Targets file do?

1 Invoke PostSharp on the assembly if necessary. This is done by calling PostSharpPostBuild.cmd for the project.
2 If the project is a PluginComponent it copies the output of the project (the dll) to \loader\bin\plugins\$PluginName\
3 If the project is a PluginComponent it copies the referenced libararies of the project to \loader\bin\plugins\$PluginName\. The location of these files is relative to the project folder. For example:

\DelftShellPlugins\DelftModels\modules\DelftShell.Plugins.DelftModels.FlowModel
\DelftShellPlugins\DelftModels\lib\DelftShell.Plugins.DelftModels.FlowModel

The subdirectory under \lib is determined by the PluginName.

The last two steps are done by calling PluginPostBuild.cmd

Location of the build files

\DelftShell.Targets : $SolutionDir\build
\PluginPostBuild.cmd: $SolutionDir\bin
\PostSharpPostBuild.cmd: $SolutionDir\bin

  • No labels