Home > Enterprise >  SSIS 2017 and Third Party .NET Assemblies
SSIS 2017 and Third Party .NET Assemblies

Time:02-01

I have solution TestName.sln(Class Library) which is built on Target Framework .Net Standard 2.0.

TestName.sln includes some dependencies 1,2 (includes its own packages), 3, from NuGet, look like a tree.

When I packed TestName.sln I got TestName.dll and I will want to use TestName.dll in SSIS 2017.

I added TestName.dll to Global Assembly Cache without any problem.

But when I try to use TestName.dll I see the classes only from TestName.sln and don't see the classes and can't use dependencies 1,2,3,4 which I included in TestName.sln.

What will I need to do in order to have all dependencies in one .dll file if possible? Or how I should link all dependencies to one for use in SSIS 2017?

CodePudding user response:

You can use ILMerge to centralize multiple dependencies into a single assembly.

Firstly, to install ILMerge.MSBuild.Tasks package from nuget.

Secondly, edit the *.csproj file of the project that you want to merge by adding the code below.

  <UsingTask TaskName="ILMerge.MSBuild.Tasks.ILMerge" AssemblyFile="$(SolutionDir)\packages\ILMerge.MSBuild.Tasks.1.0.0.3\tools\ILMerge.MSBuild.Tasks.dll" />
  <Target Name="AfterBuild">
    <ItemGroup>
      <MergeAsm Include="$(OutputPath)$(TargetFileName)" />
      <MergeAsm Include="$(OutputPath)LIB1_To_MERGE.dll" />
      <MergeAsm Include="$(OutputPath)LIB2_To_MERGE.dll" />
    </ItemGroup>
    <PropertyGroup>
      <MergedAssembly>$(ProjectDir)$(OutDir)MERGED_ASSEMBLY_NAME.exe</MergedAssembly>
    </PropertyGroup>
    <Message Text="ILMerge @(MergeAsm) -&gt; $(MergedAssembly)" Importance="high" />
    <ILMerge InputAssemblies="@(MergeAsm)" OutputFile="$(MergedAssembly)" TargetKind="SameAsPrimaryAssembly" />
  </Target>

Lastly, build your project as usual.

  • Related