简体   繁体   English

SSIS 2017 和第三方 .NET 组件

[英]SSIS 2017 and Third Party .NET Assemblies

I have solution TestName.sln(Class Library) which is built on Target Framework.Net Standard 2.0.我有基于 Target Framework.Net Standard 2.0 的解决方案 TestName.sln(Class Library)。

TestName.sln includes some dependencies 1,2 (includes its own packages), 3, from NuGet, look like a tree. TestName.sln包括一些依赖1,2(包括自己的包),3,来自NuGet,看起来像一棵树。

When I packed TestName.sln I got TestName.dll and I will want to use TestName.dll in SSIS 2017.当我打包 TestName.sln 时,我得到了 TestName.dll,我想在 SSIS 2017 中使用 TestName.dll。

I added TestName.dll to Global Assembly Cache without any problem.我将 TestName.dll 添加到全局程序集缓存中没有任何问题。

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.但是当我尝试使用 TestName.dll 时,我只看到来自 TestName.sln 的类,看不到这些类,也不能使用我包含在 TestName.sln 中的依赖项 1、2、3、4。

What will I need to do in order to have all dependencies in one.dll file if possible?如果可能的话,我需要做什么才能将所有依赖项都放在 one.dll 文件中? Or how I should link all dependencies to one for use in SSIS 2017?或者我应该如何将所有依赖项链接到一个以在 SSIS 2017 中使用?

You can use ILMerge to centralize multiple dependencies into a single assembly.您可以使用 ILMerge 将多个依赖项集中到一个程序集中。

Firstly , to install ILMerge.MSBuild.Tasks package from nuget.首先,从 nuget 安装 ILMerge.MSBuild.Tasks package。

Secondly , edit the *.csproj file of the project that you want to merge by adding the code below.其次,通过添加以下代码编辑要合并的项目的 *.csproj 文件。

  <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.最后,像往常一样构建您的项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM