我正在做一个概念验证,以了解ILRepack(ILRepack.MSBuild.Task)的工作原理。
通过这种配置,我可以创建一个合并的dll,ClassLibrary1,AutoMapper和Newtonsoft.Json正确内化:
<Target Name="AfterBuild" Condition="'$(Configuration)' == 'Release'">
<ItemGroup>
<InputAssemblies Include="$(OutputPath)\ClassLibrary2.dll" />
<InputAssemblies Include="$(OutputPath)\ClassLibrary1.dll" />
<InputAssemblies Include="$(OutputPath)\AutoMapper.dll" />
<InputAssemblies Include="$(OutputPath)\Newtonsoft.Json.dll" />
</ItemGroup>
<ItemGroup>
<!-- Must be a fully qualified name -->
<DoNotInternalizeAssemblies Include="ClassLibrary2" />
</ItemGroup>
<ILRepack Parallel="true" Internalize="true" InternalizeExclude="@(DoNotInternalizeAssemblies)" InputAssemblies="@(InputAssemblies)" TargetKind="Dll" OutputFile="$(OutputPath)\$(AssemblyName).dll" />
但是,当我尝试使用通配符时,内化不起作用:
<Target Name="AfterBuild" Condition="'$(Configuration)' == 'Release'">
<ItemGroup>
<InputAssemblies Include="$(OutputPath)\*.dll" />
</ItemGroup>
<ItemGroup>
<!-- Must be a fully qualified name -->
<DoNotInternalizeAssemblies Include="ClassLibrary2" />
</ItemGroup>
<ILRepack Parallel="true" Internalize="true" InternalizeExclude="@(DoNotInternalizeAssemblies)" InputAssemblies="@(InputAssemblies)" TargetKind="Dll" OutputFile="$(OutputPath)\$(AssemblyName).dll" />
知道为什么会这样吗?
编辑:看起来通配符重新排序程序集。 Automapper没有内化(因为成为主要程序集),但所有其他都是(除了ClassLibrary2,我想DoNotInternalizeAssemblies做它的工作)