The other day I mentioned I was working on an API to communicate with Sonic, an enterprise messaging system. After getting the API to the point where I wanted to send it to some other developers I wanted to package everything up as on DLL. ILMerge to the rescue! Sonic provides their own DLLs that were ported from Java for .NET developers. There are 7 DLLs you have to reference in order to communicate with Sonic. Here’s how this can be done using ILMerge by simply modifying the project file using an after build target. The following below does a few things.It takes all of the assemblies that are outputted to the build directory and passes that to the ILMerge command.
Once they are merged the files are deleted.<Target Name="AfterBuild">
Once they are merged the files are deleted.<Target Name="AfterBuild">
<CreateItem Include="@(ReferenceCopyLocalPaths)" Condition="'%(Extension)'=='.dll'">
<Output TaskParameter="Include" ItemName="IlmergeAssemblies" />
</CreateItem></Target>Read more: Words of Wisdom From The Elder
<Exec Command="&quot;$(MSBuildProjectPath)..\..\ThirdPartyAssemblies\Ilmerge\Ilmerge.exe&quot; /allowDup /log /keyfile:$(AssemblyOriginatorKeyFile) /out:@(MainAssembly) &quot;@(IntermediateAssembly)&quot; @(IlmergeAssemblies->'"%(FullPath)"', ' ')" />
<Delete Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" />
0 comments:
Post a Comment