Skip to content

Commit fe6a8b2

Browse files
Update to ILRepack 2.0.29 (#50)
Adds new task parameter item: InternalizeAssembly - a list of specific assembly names to internalize.
1 parent 25a8fc3 commit fe6a8b2

File tree

5 files changed

+37
-6
lines changed

5 files changed

+37
-6
lines changed

ILRepack.Lib.MSBuild.Task/ILRepack.Lib.MSBuild.Task.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
<PropertyGroup>
44
<TargetFramework>net472</TargetFramework>
5-
<Version>2.0.26</Version>
5+
<Version>2.0.29</Version>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="ILRepack" Version="2.0.26" GeneratePathProperty="true"/>
10-
<PackageReference Include="ILRepack.Lib" Version="2.0.26"/>
9+
<PackageReference Include="ILRepack" Version="2.0.29" GeneratePathProperty="true"/>
10+
<PackageReference Include="ILRepack.Lib" Version="2.0.29"/>
1111
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.8.3"/>
1212
</ItemGroup>
1313

ILRepack.Lib.MSBuild.Task/ILRepack.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ public virtual string TargetKind
143143
/// </summary>
144144
public virtual ITaskItem[] InternalizeExclude { get; set; }
145145

146+
/// <summary>
147+
/// List of specific assemblies to internalize.
148+
/// </summary>
149+
public virtual ITaskItem[] InternalizeAssembly { get; set; }
150+
146151
/// <summary>
147152
/// Output name for the merged assembly.
148153
/// </summary>
@@ -321,6 +326,11 @@ public override bool Execute()
321326

322327
repackOptions.InputAssemblies = assemblies;
323328

329+
if (InternalizeAssembly != null && InternalizeAssembly.Any())
330+
{
331+
repackOptions.InternalizeAssemblies = InternalizeAssembly.Select(i => StripExtension(i.ItemSpec)).ToArray();
332+
}
333+
324334
// Path that will be used when searching for assemblies to merge.
325335
var searchPath = new List<string> { "." };
326336
searchPath.AddRange(LibraryPath.Select(iti => BuildPath(iti.ItemSpec)));
@@ -393,6 +403,26 @@ private static string BuildPath(string path)
393403
return string.IsNullOrEmpty(path) ? null : Path.Combine(workDir, path);
394404
}
395405

406+
/// <summary>
407+
/// Strips .dll or .exe extension from filePath if present.
408+
/// </summary>
409+
/// <param name="filePath">File path</param>
410+
/// <returns>File path without the extension.</returns>
411+
private static string StripExtension(string filePath)
412+
{
413+
if (filePath == null)
414+
{
415+
return null;
416+
}
417+
418+
if (filePath.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) || filePath.EndsWith(".exe", StringComparison.OrdinalIgnoreCase))
419+
{
420+
filePath = filePath.Substring(0, filePath.Length - 4);
421+
}
422+
423+
return filePath;
424+
}
425+
396426
#endregion
397427

398428
#region IDisposable

ILRepack.Lib.MSBuild.Task/build/ILRepack.Lib.MSBuild.Task.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
33
<metadata>
44
<id>ILRepack.Lib.MSBuild.Task</id>
5-
<version>2.0.26</version>
5+
<version>2.0.29</version>
66
<title>ILRepack.Lib.MSBuild.Task</title>
77
<authors>RBSoft</authors>
88
<owners>rbsoft</owners>

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ You can turn this functionality off by setting ClearOutputDirectory to False as
107107
| XmlDocumentation | Merge assembly XML documentation. |
108108
| LibraryPath | List of paths to use as "include directories" when attempting to merge assemblies. |
109109
| Internalize | Set all types but the ones from the first assembly 'internal'. |
110+
| InternalizeAssembly | Internalize only specific assemblies (list of assembly names without path or extension). |
110111
| RenameInternalized | Rename all internalized types (to be used when Internalize is enabled). |
111112
| ExcludeInternalizeSerializable | Do not internalize types marked as Serializable. |
112113
| InternalizeExclude | If Internalize is set to true, any which match these regular expressions will not be internalized. If Internalize is false, then this property is ignored. |

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
version: 2.0.26.{build}
1+
version: 2.0.29.{build}
22
environment:
3-
my_version: 2.0.26
3+
my_version: 2.0.29
44
my_secret:
55
secure: 5qtuEW0UQ/IEO8DRi4/y3EgEBoJDM/HyYpPgzasIlm0=
66
skip_branch_with_pr: true

0 commit comments

Comments
 (0)