0

I've create a Project, which contains two folders. The "src" folder contains coreelements, the "plugin" folder contains different plugins (each plugin = one file).

Here an example:

MyProject
|_src
    |_attributeclass.cs
    |_basepluginparent.cs
    |_otherneededclass.cs
|_plugins
    |_plugin1extendsfrombaseclass.cs
    |_plugin2extendsfrombaseclass.cs
    |_plugin3extendsfrombaseclass.cs
    |_plugin4extendsfrombaseclass.cs

Now I want to start a build, which creates me 5 files : 1 baseplugin.dll ( containing all 3 coreclasses) 4 files called plugin1.dll ... plugin4.dll

so all plugin refer to baseclass, but i also need the baseclass as own library

How can I do this?

Kooki
  • 1,157
  • 9
  • 30

2 Answers2

1

Create five Projects: one that builds coreclasses.dll, the other that builds each of the plugins.

James McNellis
  • 348,265
  • 75
  • 913
  • 977
  • Yeah thats my actual solution, but it's laborious, cause there are not only four but nearly 20 different plugins, so I want to solve this in one solution. – Kooki Nov 29 '12 at 20:58
  • A Solution can have multiple Projects, and you can put all of the configuration for the projects into a single, shared .props file--then each project file simply needs to contain the list of files to be built. – James McNellis Nov 29 '12 at 21:00
  • I found a solution to get multiple output dll's from one project ([solution](http://stackoverflow.com/a/3867326/1165125)), but I need a possibility too, to make the build dependent by folders.do you have any idea? – Kooki Nov 29 '12 at 21:05
  • I would recommend having different projects for each final output. – James McNellis Nov 29 '12 at 21:06
  • But (I think) it's better for my project to have only one project with all plugins,cause all plugins depend on the coreclass and should be childclasses.please wait a minute, i edit the question :-) – Kooki Nov 29 '12 at 21:09
1

If you wan't to handle it using MSBuild, couldn't you do something like:

<Csc Sources="_src\*.cs" 
     TargetType="library"
     OutputAssembly="Out\Base.dll" />

to compile the base.dll, and then create an itemgroup of the plugins and build them in batches:

<ItemGroup>
  <Plugin Include="_plugins\*.cs" />
</ItemGroup>

<Message Text="%(Plugin.Identity) => %(Plugin.Filename).dll" />

<Csc Sources="%(Plugin.Identity)"
     References="Out\Base.dll"
     TargetType="library"
     OutputAssembly="Out\%(Plugin.Filename).dll" />

This will get you one plugin dll per source file - each linked to the base.dll.

Edit: To make it part of your project build wrap all of the above in a target, such as:

<Target Name="BeforeBuild">

</Target>

and put it at the end of your project file (unload the project and edit the project file).

MBL
  • 151
  • 4
  • Thanks a lot, nearly perfect solution, I only had to make some little changes to get it work. Perfect first answer :-) – Kooki Nov 30 '12 at 09:11