You could create one project for each plugin and group all projects in a solution.
If you don’t want to have one project per plugin, you could create a custom build with MSBuild using CSC task
How to generate a dll for each plugin file
-
In a project you add all plugins files
-
Edit the project file to specify which class will generate a plugin library :
<ItemGroup> <Compile Include="Class1.cs"> <Plugin>true</Plugin> </Compile> <Compile Include="Class2.cs" /> <Compile Include="Class3.cs"> <Plugin>true</Plugin> </Compile> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup>
-
Add a new target in your project file to generate the plugins library
<Target Name="BuildPlugins"> <CSC Condition="%(Compile.Plugin) == 'true'" Sources="%(Compile.FullPath)" TargetType="library" OutputAssembly="$(OutputPath)%(Compile.FileName).dll" EmitDebugInformation="true" /> </Target>
-
If you want to create the plugins library after each build, add an after build target :
<Target Name="AfterBuild" DependsOnTargets="BuildPlugins"> </Target>