forked from ravibpatel/ILRepack.Lib.MSBuild.Task
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathILRepack.Lib.MSBuild.targets
More file actions
54 lines (44 loc) · 3.26 KB
/
ILRepack.Lib.MSBuild.targets
File metadata and controls
54 lines (44 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(ProjectDir)ILRepack.Config.props" Condition="Exists('$(ProjectDir)ILRepack.Config.props')" />
<PropertyGroup>
<ILRepackMsBuildPath Condition=" '$(ILRepackMsBuildPath)' == '' And '$(MSBuildRuntimeType)' == 'Core' ">$(MSBuildThisFileDirectory)\..\tools\netcoreapp3.1\ILRepack.Lib.MSBuild.dll</ILRepackMsBuildPath>
<ILRepackMsBuildPath Condition=" '$(ILRepackMsBuildPath)' == '' And '$(MSBuildRuntimeType)' != 'Core' ">$(MSBuildThisFileDirectory)\..\tools\net461\ILRepack.Lib.MSBuild.dll</ILRepackMsBuildPath>
<ILRepackTargetsFile Condition=" '$(ILRepackTargetsFile)' == '' ">$(ProjectDir)ILRepack.targets</ILRepackTargetsFile>
<DoILRepack Condition=" '$(DoILRepack)' == '' and $(Configuration.Contains('Release')) and !Exists('$(ILRepackTargetsFile)') ">true</DoILRepack>
<ILRepackInternalize Condition=" '$(ILRepackInternalize)' == '' and '$(TargetExt)' == '.exe'">true</ILRepackInternalize>
</PropertyGroup>
<Import Project="$(ILRepackTargetsFile)" Condition="Exists('$(ILRepackTargetsFile)')" />
<Target Name="_ResolveILRepackTargets">
<ItemGroup>
<ILRepackLibPath Condition=" '@(ILRepackLibPath)' == '' " Include="$(OutputPath)"/>
<ILRepackAllLibPath Include="@(ILRepackLibPath);@(ILRepackExtraLibPath)"/>
<ILRepackExcludes Include="@(ILRepackExcludeAssemblies -> '$(OutputPath)%(Filename)%(Extension)')" />
<ILRepackSrcAssemblies Condition=" '@(ILRepackMergeAssemblies)' != '' " Include="@(ILRepackMergeAssemblies -> '$(OutputPath)%(Filename)%(Extension)')"/>
<ILRepackSrcAssemblies Condition=" '@(ILRepackMergeAssemblies)' == '' " Include="$(OutputPath)*.dll" Exclude="$(OutputPath)$(TargetName)$(TargetExt);@(ILRepackExcludes)"/>
<ILRepackInputAssemblies Condition=" '@(ILRepackInputAssemblies)' == '' " Include="$(OutputPath)$(TargetName)$(TargetExt);@(ILRepackSrcAssemblies)" />
<AssembliesToDelete Include="@(ILRepackInputAssemblies)" Exclude="$(OutputPath)$(TargetName)$(TargetExt)" />
<PdbToDelete Include="@(AssembliesToDelete -> '%(RelativeDir)%(Filename).pdb')" />
<XmlToDelete Include="@(AssembliesToDelete -> '%(RelativeDir)%(Filename).xml')" />
<ConfigToDelete Include="@(AssembliesToDelete -> '%(RelativeDir)%(Filename)%(Extension).config')" />
<ILRepackToDelete Include="@(AssembliesToDelete);@(PdbToDelete);@(XmlToDelete);@(ConfigToDelete)" />
</ItemGroup>
</Target>
<UsingTask AssemblyFile="$(ILRepackMsBuildPath)" TaskName="ILRepack" />
<Target Name="ILRepack" AfterTargets="Build" Condition=" '$(DoILRepack)' == 'true' " DependsOnTargets="_ResolveILRepackTargets">
<ILRepack
Parallel="true"
Internalize="$(ILRepackInternalize)"
DebugInfo="true"
AllowDuplicateResources="false"
InputAssemblies="@(ILRepackInputAssemblies)"
LibraryPath="@(ILRepackAllLibPath)"
InternalizeExclude="@(DoNotInternalizePatterns)"
InternalizeExcludeAssemblies="@(DoNotInternalizeAssemblies)"
TargetKind="SameAsPrimaryAssembly"
KeyFile="$(KeyFile)"
OutputFile="$(OutputPath)$(TargetName)$(TargetExt)"
/>
<Delete Files="@(ILRepackToDelete)"/>
</Target>
</Project>