Kooki
Kooki

Reputation: 1157

Project with different Outputfiles

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?

Upvotes: 0

Views: 133

Answers (2)

MBL
MBL

Reputation: 151

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).

Upvotes: 1

James McNellis
James McNellis

Reputation: 355297

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

Upvotes: 1

Related Questions