Build project's components to own .dlls

80 Views Asked by At

I have project, which contains lot of classes. I use this project as plugin base for one of my application. This app can load all these plugins from one .dll builded from this project.

Problem is, I need to use these plugins in third-side app. This app can load only one plugin per .dll. I have very few options here. As far as I know, I could create new project for each file and build them. But it is sloppy way how to solve it.

So, is there any way, how to build one project for each of its classes or for groups of classes?

It sounds to me as task for some script. Is possible to achieve this for example with psake or powershell?

Thanks in regards

2

There are 2 best solutions below

2
On

Well, I believe that they are already doing that in their own bin directories. That`s if you mean assemblies as components. If you are talking about classes, then you should place them in separate assemblies and use the same approach.

You can right click on assembly and go to properties, build where you can see the 'output path' field as well as 'XML documentation' checkbox which is required for third-side apps to see your XML comments while using .dll-s.

0
On

One way I can think of is to create a 'template' project file based on the Plugin project you already have. You can make a copy of the plugin.csproj and then delete all included plugin classes. Using psake and Powershell you can dynamically add the plugin class you need an assembly for and then call MSBuild to build the csproj.

 <ItemGroup>
    <Compile Include="MyFirstPlugin.cs" />
 </ItemGroup>

Adding xml-nodes like this to an csproj-file is easy to do in Powershell.

The pseudo code for the ps script could be something like this;

define list of plugin cs-files 
for each plugin cs file   
    copy template.csproj to plugin.csproj
    add xml node to include plugin.cs file
    call msbuild on plugin.csproj
    delete plugin.csproj file