Merging DLLs in the new csproj project format (excluding specific NuGet packages)
TL;DR
There’s no breakthrough in this blogpost… It’s just to show you how does the new .csproj look like, what basic things can be done in msbuild and how-to setup ILRepack for common data service painlessly.
ILMerge vs. ILRepack
Let me start with this statement: It’s not supported to use ILMerge (or any other tool) for merging assemblies for CDS. But it’s not forbidden either… A lot of you – CDS developers – are using ILMerge. It’s easy to use and works as expected. But it has one flaw. I couldn’t setup ILMerge with the new .csproj format. I think, that it’s possible, but this was impulse to move to ILRepack, which I was sure, that it supports the new .csproj format and it’s opensource replacement of ILMerge. You can check it out on GitHub.
How to correctly setup ILRepack for your libraries with codeactivities and plugins
This is something that can be done with some research quite easily, there’s nothing hard/special, that you need to know. But I couldn’t find guide that solved all my issues, so I write this blogpost with all steps that I had to apply. I’ll try to explain them, so you can understand how it works. Let’s get to it. Before we start tweaking our .csproj, you need to install ILRepack nuget package to your project. Now it’s just about adding some parts into .csproj:
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<!-- You start with something like this - new .csproj format -->
<PropertyGroup>
<TargetFramework>net452</TargetFramework>
<AssemblyName>Talxis.Buildings.Sales.Features.ARES.Extension.CompositionLayer</AssemblyName>
<RootNamespace>Talxis.Buildings.Sales.Features.ARES.Extension.CompositionLayer</RootNamespace>
<Deterministic>false</Deterministic>
<Version>1.0.0.0</Version>
<AssemblyVersion>1.0.*</AssemblyVersion>
<FileVersion>1.0.*</FileVersion>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Infrastructure\Infrastructure.CompositionLayer\Infrastructure.CompositionLayer.csproj" />
<ProjectReference Include="..\Features.ARES.Extension.BusinessLayer\Sales.Features.ARES.Extension.BusinessLayer.csproj" />
</ItemGroup>
</Project>
Leave a Comment
Your email address will not be published. Required fields are marked *